本文整理了Java中querqy.model.Query.getClauses
方法的一些代码示例,展示了Query.getClauses
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getClauses
方法的具体详情如下:
包路径:querqy.model.Query
类名称:Query
方法名:getClauses
暂无
代码示例来源:origin: renekrie/querqy
@Override
public T visit(final Query query) {
for (final BooleanClause clause : query.getClauses()) {
clause.accept(this);
}
return null;
}
代码示例来源:origin: renekrie/querqy
@Override
public Node visit(final Query query) {
Query clone = new Query();
newParentStack.add(clone);
for (final BooleanClause clause : query.getClauses()) {
clone.addClause((BooleanClause) clause.accept(this));
}
newParentStack.removeLast();
return clone;
}
代码示例来源:origin: renekrie/querqy
if (t.length() > 0) {
Query query = termsToQuery(t);
if (!query.getClauses().isEmpty()) {
for (Input input : inputs) {
BoostInstruction bi = new BoostInstruction(query, direction, boost);
代码示例来源:origin: renekrie/querqy
final List<BooleanClause> clauses = ((querqy.model.Query) userQuery).getClauses();
代码示例来源:origin: renekrie/querqy
if (query.getClauses().isEmpty()) {
DisjunctionMaxQuery dmq = new DisjunctionMaxQuery(query, Occur.SHOULD, false);
dmq.addClause(new Term(dmq, input));
代码示例来源:origin: renekrie/querqy
@Test
public void testThatTermIsRemovedIfThereIsAnotherTermInTheSameDMQ() throws Exception {
RulesCollectionBuilder builder = new TrieMapRulesCollectionBuilder(false);
DeleteInstruction delete = new DeleteInstruction(Arrays.asList(mkTerm("a")));
builder.addRule(new Input(Arrays.asList(mkTerm("a")), false, false), new Instructions(Arrays.asList((Instruction) delete)));
RulesCollection rules = builder.build();
CommonRulesRewriter rewriter = new CommonRulesRewriter(rules);
ExpandedQuery expandedQuery = makeQuery("a");
Query query = (Query) expandedQuery.getUserQuery();
DisjunctionMaxQuery dmq = query.getClauses(DisjunctionMaxQuery.class).get(0);
querqy.model.Term termB = new querqy.model.Term(dmq, null, "b");
dmq.addClause(termB);
Query rewritten = (Query) rewriter.rewrite(expandedQuery, EMPTY_CONTEXT).getUserQuery();
assertThat(rewritten,
bq(
dmq(
term("b")
)
));
}
代码示例来源:origin: renekrie/querqy
@Test
public void testThatTermIsRemovedOnceIfItExistsTwiceInSameDMQAndNoOtherTermExistsInQuery() throws Exception {
RulesCollectionBuilder builder = new TrieMapRulesCollectionBuilder(false);
DeleteInstruction delete = new DeleteInstruction(Arrays.asList(mkTerm("a")));
builder.addRule(new Input(Arrays.asList(mkTerm("a")), false, false), new Instructions(Arrays.asList((Instruction) delete)));
RulesCollection rules = builder.build();
CommonRulesRewriter rewriter = new CommonRulesRewriter(rules);
ExpandedQuery expandedQuery = makeQuery("a");
Query query = (Query) expandedQuery.getUserQuery();
DisjunctionMaxQuery dmq = query.getClauses(DisjunctionMaxQuery.class).get(0);
querqy.model.Term termB = new querqy.model.Term(dmq, null, "a");
dmq.addClause(termB);
Query rewritten = (Query) rewriter.rewrite(expandedQuery, EMPTY_CONTEXT).getUserQuery();
assertThat(rewritten,
bq(
dmq(
term("a")
)
));
}
内容来源于网络,如有侵权,请联系作者删除!