querqy.model.Query.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(261)

本文整理了Java中querqy.model.Query.<init>方法的一些代码示例,展示了Query.<init>的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.<init>方法的具体详情如下:
包路径:querqy.model.Query
类名称:Query
方法名:<init>

Query.<init>介绍

暂无

代码示例

代码示例来源:origin: renekrie/querqy

  1. @Override
  2. public Node visitQuery(QueryContext ctx) {
  3. query = new Query();
  4. operatorStack.add(Operator.NONE);
  5. booleanQueryStack.add(query);
  6. super.visitQuery(ctx);
  7. operatorStack.removeLast();
  8. return booleanQueryStack.removeLast();
  9. }

代码示例来源:origin: renekrie/querqy

  1. @Override
  2. public Query clone(final BooleanParent newParent, final Occur occur, final boolean generated) {
  3. final Query q = new Query(generated);
  4. for (final BooleanClause clause : clauses) {
  5. q.addClause(clause.clone(q, generated));
  6. }
  7. return q;
  8. }

代码示例来源:origin: renekrie/querqy

  1. @Override
  2. public Node visit(final Query query) {
  3. Query clone = new Query();
  4. newParentStack.add(clone);
  5. for (final BooleanClause clause : query.getClauses()) {
  6. clone.addClause((BooleanClause) clause.accept(this));
  7. }
  8. newParentStack.removeLast();
  9. return clone;
  10. }

代码示例来源:origin: renekrie/querqy

  1. Query termsToQuery(String termsQuery) {
  2. Query query = new Query();
  3. for (String t : termsQuery.split("\\s+")) {
  4. if (t.length() > 0) {
  5. DisjunctionMaxQuery dmq = new DisjunctionMaxQuery(query, Occur.SHOULD, false);
  6. query.addClause(dmq);
  7. Term term = new Term(dmq, t);
  8. dmq.addClause(term);
  9. }
  10. }
  11. return query;
  12. }

代码示例来源:origin: renekrie/querqy

  1. Query query = new Query();

代码示例来源:origin: renekrie/querqy

  1. public static Query parseString(final String input) {
  2. final Query query = new Query();

代码示例来源:origin: renekrie/querqy

  1. ? new Query(true)
  2. : new BooleanQuery(query.getParent(), query.getOccur(), true);

代码示例来源:origin: renekrie/querqy

  1. @Test
  2. public void testThatShinglingDoesNotTriggerExceptionOnSingleTerm() throws Exception {
  3. Query query = new Query();
  4. addTerm(query, "t1");
  5. ExpandedQuery expandedQuery = new ExpandedQuery(query);
  6. ShingleRewriter rewriter = new ShingleRewriter();
  7. rewriter.rewrite(expandedQuery);
  8. assertThat((Query) expandedQuery.getUserQuery(),
  9. bq(
  10. dmq(
  11. term("t1")
  12. )
  13. )
  14. );
  15. }

代码示例来源:origin: renekrie/querqy

  1. @Test
  2. public void testShinglingForTwoTokensWithOnFieldNameNullDontShingle() {
  3. Query query = new Query();
  4. addTerm(query, "f1", "cde");
  5. addTerm(query, "ajk");
  6. ExpandedQuery expandedQuery = new ExpandedQuery(query);
  7. ShingleRewriter rewriter = new ShingleRewriter();
  8. rewriter.rewrite(expandedQuery);
  9. assertThat((Query) expandedQuery.getUserQuery(), bq(dmq(term("f1", "cde")), dmq(term("ajk"))));
  10. }

代码示例来源:origin: renekrie/querqy

  1. @Test
  2. public void testShinglingForTwoTokensWithDifferentFieldsDontShingle() {
  3. Query query = new Query();
  4. addTerm(query, "f1", "cde");
  5. addTerm(query, "f2", "ajk");
  6. ExpandedQuery expandedQuery = new ExpandedQuery(query);
  7. ShingleRewriter rewriter = new ShingleRewriter();
  8. rewriter.rewrite(expandedQuery);
  9. assertThat((Query) expandedQuery.getUserQuery(), bq(dmq(term("cde")), dmq(term("ajk"))));
  10. }

代码示例来源:origin: renekrie/querqy

  1. @Test
  2. public void testShinglingForTwoTokensWithSameFieldAndGeneratedFlag() {
  3. Query query = new Query();
  4. addTerm(query, "f1", "cde", true);
  5. addTerm(query, "f1", "ajk", true);
  6. ExpandedQuery expandedQuery = new ExpandedQuery(query);
  7. ShingleRewriter rewriter = new ShingleRewriter(true);
  8. rewriter.rewrite(expandedQuery);
  9. assertThat((Query) expandedQuery.getUserQuery(),
  10. bq(
  11. dmq(
  12. term("f1", "cde"),
  13. term("f1", "cdeajk")
  14. ),
  15. dmq(
  16. term("f1", "ajk"),
  17. term("f1", "cdeajk")
  18. )
  19. )
  20. );
  21. }

代码示例来源:origin: renekrie/querqy

  1. @Test
  2. public void testShinglingForTwoTokensWithSameField() {
  3. Query query = new Query();
  4. addTerm(query, "f1", "cde");
  5. addTerm(query, "f1", "ajk");
  6. ExpandedQuery expandedQuery = new ExpandedQuery(query);
  7. ShingleRewriter rewriter = new ShingleRewriter();
  8. rewriter.rewrite(expandedQuery);
  9. assertThat((Query) expandedQuery.getUserQuery(),
  10. bq(
  11. dmq(
  12. term("f1", "cde"),
  13. term("f1", "cdeajk")
  14. ),
  15. dmq(
  16. term("f1", "ajk"),
  17. term("f1", "cdeajk")
  18. )
  19. )
  20. );
  21. }

代码示例来源:origin: renekrie/querqy

  1. @Test
  2. public void testShinglingForTwoTokens() {
  3. Query query = new Query();
  4. addTerm(query, "cde");
  5. addTerm(query, "ajk");
  6. ExpandedQuery expandedQuery = new ExpandedQuery(query);
  7. ShingleRewriter rewriter = new ShingleRewriter();
  8. rewriter.rewrite(expandedQuery);
  9. assertThat((Query) expandedQuery.getUserQuery(),
  10. bq(
  11. dmq(
  12. term("cde"),
  13. term("cdeajk")
  14. ),
  15. dmq(
  16. term("ajk"),
  17. term("cdeajk")
  18. )
  19. )
  20. );
  21. }

代码示例来源:origin: renekrie/querqy

  1. @Test
  2. public void testShinglingForThreeTokensWithOneTokenGeneratedIgnoringGenerated() {
  3. Query query = new Query();
  4. addTerm(query, "cde", false);
  5. addTerm(query, "ajk", false);
  6. addTerm(query, "xyz", true);
  7. ExpandedQuery expandedQuery = new ExpandedQuery(query);
  8. ShingleRewriter rewriter = new ShingleRewriter(false);
  9. rewriter.rewrite(expandedQuery);
  10. assertThat((Query) expandedQuery.getUserQuery(),
  11. bq(
  12. dmq(
  13. term("cde"),
  14. term("cdeajk")
  15. ),
  16. dmq(
  17. term("ajk"),
  18. term("cdeajk")
  19. ),
  20. dmq(
  21. term("xyz")
  22. )
  23. )
  24. );
  25. }

代码示例来源:origin: renekrie/querqy

  1. @Test
  2. public void testShinglingForThreeTokensWithMixedFields() {
  3. Query query = new Query();
  4. addTerm(query, "f1", "cde");
  5. addTerm(query, "f1", "ajk");
  6. addTerm(query, "f2", "xyz");
  7. ExpandedQuery expandedQuery = new ExpandedQuery(query);
  8. ShingleRewriter rewriter = new ShingleRewriter();
  9. rewriter.rewrite(expandedQuery);
  10. assertThat((Query) expandedQuery.getUserQuery(),
  11. bq(
  12. dmq(
  13. term("f1", "cde"),
  14. term("f1", "cdeajk")
  15. ),
  16. dmq(
  17. term("f1", "ajk"),
  18. term("f1", "cdeajk")
  19. ),
  20. dmq(term("f2", "xyz"))
  21. )
  22. );
  23. }

代码示例来源:origin: renekrie/querqy

  1. @Test
  2. public void testShingleWithHyphens() throws Exception {
  3. Query query = new Query();
  4. addTerm(query, "cde-fgh", false);
  5. addTerm(query, "-", false);

代码示例来源:origin: renekrie/querqy

  1. @Test
  2. public void testShinglingForThreeTokens() {
  3. Query query = new Query();
  4. addTerm(query, "cde");
  5. addTerm(query, "ajk");
  6. addTerm(query, "xyz");
  7. ExpandedQuery expandedQuery = new ExpandedQuery(query);
  8. ShingleRewriter rewriter = new ShingleRewriter();
  9. rewriter.rewrite(expandedQuery);
  10. assertThat((Query) expandedQuery.getUserQuery(),
  11. bq(
  12. dmq(
  13. term("cde"),
  14. term("cdeajk")
  15. ),
  16. dmq(
  17. term("ajk"),
  18. term("cdeajk"),
  19. term("ajkxyz")
  20. ),
  21. dmq(
  22. term("xyz"),
  23. term("ajkxyz")
  24. )
  25. )
  26. );
  27. }

代码示例来源:origin: renekrie/querqy

  1. @Test
  2. public void testShinglingForThreeTokensWithThreeTokenGenerated() {
  3. Query query = new Query();
  4. addTerm(query, "cde", true);
  5. addTerm(query, "ajk", true);
  6. addTerm(query, "xyz", true);
  7. ExpandedQuery expandedQuery = new ExpandedQuery(query);
  8. ShingleRewriter rewriter = new ShingleRewriter(true);
  9. rewriter.rewrite(expandedQuery);
  10. assertThat((Query) expandedQuery.getUserQuery(),
  11. bq(
  12. dmq(
  13. term("cde"),
  14. term("cdeajk")
  15. ),
  16. dmq(
  17. term("ajk"),
  18. term("cdeajk"),
  19. term("ajkxyz")
  20. ),
  21. dmq(
  22. term("xyz"),
  23. term("ajkxyz")
  24. )
  25. )
  26. );
  27. }

相关文章