Package org.apache.lucene.search.spans

Examples of org.apache.lucene.search.spans.SpanOrQuery


    for (QueryNode child : children) {
      spanQueries[i++] = (SpanQuery) child
          .getTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID);
    }

    return new SpanOrQuery(spanQueries);

  }
View Full Code Here


    assertTrue("Failed to find correct number of highlights " + numHighlights + " found",
        numHighlights == 3);
  }
 
  public void testSpanRegexQuery() throws Exception {
    query = new SpanOrQuery(new SpanQuery [] {
        new SpanRegexQuery(new Term(FIELD_NAME, "ken.*")) });
    searcher = new IndexSearcher(ramDir, true);
    hits = searcher.search(query);
    int maxNumFragmentsRequired = 2;

View Full Code Here

  public SpanOrQuery sor(String s, String e) {
    return sor(st(s), st(e));
  }
  /** MACRO for SpanOrQuery containing two SpanQueries */
  public SpanOrQuery sor(SpanQuery s, SpanQuery e) {
    return new SpanOrQuery(new SpanQuery[] { s, e });
  }
View Full Code Here

  public SpanOrQuery sor(String s, String m, String e) {
    return sor(st(s), st(m), st(e));
  }
  /** MACRO for SpanOrQuery containing two SpanQueries */
  public SpanOrQuery sor(SpanQuery s, SpanQuery m, SpanQuery e) {
    return new SpanOrQuery(new SpanQuery[] { s, m, e });
  }
View Full Code Here

      sqs[i] = new SpanTermQuery(tq.getTerm());
      sqs[i].setBoost(tq.getBoost());
    }

    SpanOrQuery query = new SpanOrQuery(sqs);
    query.setBoost(orig.getBoost());

    return query;
  }
View Full Code Here

        int position = 0;
        final SpanQuery[] clauses = new SpanQuery[distinctPositions];
        for (int i = 0; i < disjunctLists.length; ++i) {
          List disjuncts = disjunctLists[i];
          if (disjuncts != null) {
            clauses[position++] = new SpanOrQuery((SpanQuery[]) disjuncts
                .toArray(new SpanQuery[disjuncts.size()]));
          } else {
            ++positionGaps;
          }
        }
View Full Code Here

        numHighlights == 4);
   
  }
 
  public void testSpanRegexQuery() throws Exception {
    query = new SpanOrQuery(new SpanQuery [] {
        new SpanRegexQuery(new Term(FIELD_NAME, "ken.*")) });
    searcher = new IndexSearcher(ramDir, true);
    hits = searcher.search(query, 100);
    int maxNumFragmentsRequired = 2;

View Full Code Here

        int position = 0;
        final SpanQuery[] clauses = new SpanQuery[distinctPositions];
        for (int i = 0; i < disjunctLists.length; ++i) {
          List<Query> disjuncts = disjunctLists[i];
          if (disjuncts != null) {
            clauses[position++] = new SpanOrQuery(disjuncts
                .toArray(new SpanQuery[disjuncts.size()]));
          } else {
            ++positionGaps;
          }
        }
View Full Code Here

  }

  // LUCENE-3831
  public void testPassesIfWrapped() throws IOException {
    EmptyMTQ q = new EmptyMTQ();
    SpanQuery wrappedquery = new SpanOrQuery(new SpanMultiTermQueryWrapper<EmptyMTQ>(q));

    MemoryIndex mindex = new MemoryIndex();
    mindex.addField("field", new MockAnalyzer(random).tokenStream("field", new StringReader("hello there")));

    // This passes though
View Full Code Here

  public SpanOrQuery sor(String s, String e) {
    return sor(st(s), st(e));
  }
  /** MACRO for SpanOrQuery containing two SpanQueries */
  public SpanOrQuery sor(SpanQuery s, SpanQuery e) {
    return new SpanOrQuery(s, e);
  }
View Full Code Here

TOP

Related Classes of org.apache.lucene.search.spans.SpanOrQuery

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.