Examples of Occur


Examples of org.apache.lucene.search.BooleanClause.Occur

      assumeTrue("unlucky index", highFreq - 1 > lowFreq);
      List<TermAndFreq> highTerms = queueToList(highFreqQueue);
      List<TermAndFreq> lowTerms = queueToList(lowFreqQueue);
     
      IndexSearcher searcher = newSearcher(reader);
      Occur lowFreqOccur = randomOccur(random());
      BooleanQuery verifyQuery = new BooleanQuery();
      CommonTermsQuery cq = new CommonTermsQuery(randomOccur(random()),
          lowFreqOccur, highFreq - 1, random().nextBoolean());
      for (TermAndFreq termAndFreq : lowTerms) {
        cq.add(new Term(field, termAndFreq.term));
View Full Code Here

Examples of org.apache.lucene.search.BooleanClause.Occur

      setString(n1, "text", descr);
      add(n, n1);
      for (int i = 0; i < clauses.length; i++) {
        n1 = create("node");
        String occur;
        Occur occ = clauses[i].getOccur();
        if (occ.equals(Occur.MUST)) {
          occur = "MUST";
        } else if (occ.equals(Occur.MUST_NOT)) {
          occur = "MUST_NOT";
        } else if (occ.equals(Occur.SHOULD)) {
          occur = "SHOULD";
        } else {
          occur = occ.toString();
        }
        setString(n1, "text", "Clause " + i + ": " + occur);
        add(n, n1);
        _explainStructure(n1, clauses[i].getQuery());
      }
View Full Code Here

Examples of org.apache.lucene.search.BooleanClause.Occur

    if (!value.isTextual()) {
      throw new ParseException("Invalid property'" + OCCUR_PROPERTY + "': value is not textual");
    }

    try {
      final Occur occur = Occur.valueOf(value.asText());
      switch (occur) {
        case MUST:
          return Modifier.MOD_REQ;

        case SHOULD:
View Full Code Here

Examples of org.apache.lucene.search.BooleanClause.Occur

  // verify parsing of query using a stopping analyzer
  private void assertStopQueryEquals(String qtxt, String expectedRes)
      throws Exception {
    String[] fields = { "b", "t" };
    Occur occur[] = { Occur.SHOULD, Occur.SHOULD };
    TestQPHelper.QPTestAnalyzer a = new TestQPHelper.QPTestAnalyzer();
    StandardQueryParser mfqp = new StandardQueryParser();
    mfqp.setMultiFields(fields);
    mfqp.setAnalyzer(a);
View Full Code Here

Examples of org.apache.lucene.search.BooleanClause.Occur

  }

  // verify parsing of query using a stopping analyzer 
  private void assertStopQueryEquals (String qtxt, String expectedRes) throws Exception {
    String[] fields = {"b", "t"};
    Occur occur[] = {Occur.SHOULD, Occur.SHOULD};
    TestQueryParser.QPTestAnalyzer a = new TestQueryParser.QPTestAnalyzer();
    MultiFieldQueryParser mfqp = new MultiFieldQueryParser(TEST_VERSION_CURRENT, fields, a);
   
    Query q = mfqp.parse(qtxt);
    assertEquals(expectedRes, q.toString());
View Full Code Here

Examples of org.apache.lucene.search.BooleanClause.Occur

  // verify parsing of query using a stopping analyzer
  private void assertStopQueryEquals(String qtxt, String expectedRes)
      throws Exception {
    String[] fields = { "b", "t" };
    Occur occur[] = { Occur.SHOULD, Occur.SHOULD };
    TestQPHelper.QPTestAnalyzer a = new TestQPHelper.QPTestAnalyzer();
    StandardQueryParser mfqp = new StandardQueryParser();
    mfqp.setMultiFields(fields);
    mfqp.setAnalyzer(a);
View Full Code Here

Examples of org.apache.lucene.search.BooleanClause.Occur

  }

  // verify parsing of query using a stopping analyzer 
  private void assertStopQueryEquals (String qtxt, String expectedRes) throws Exception {
    String[] fields = {"b", "t"};
    Occur occur[] = {Occur.SHOULD, Occur.SHOULD};
    TestQueryParser.QPTestAnalyzer a = new TestQueryParser.QPTestAnalyzer();
    MultiFieldQueryParser mfqp = new MultiFieldQueryParser(TEST_VERSION_CURRENT, fields, a);
   
    Query q = mfqp.parse(qtxt);
    assertEquals(expectedRes, q.toString());
View Full Code Here

Examples of org.apache.lucene.search.BooleanClause.Occur

    this.booleanClause = booleanClause;
  }

  @Override
  public void write(DataOutput out) throws IOException {
    Occur occur = booleanClause.getOccur();
    switch (occur) {
    case MUST:
      out.write(0);
      break;
    case MUST_NOT:
View Full Code Here

Examples of org.apache.lucene.search.BooleanClause.Occur

    new QueryWritable(booleanClause.getQuery()).write(out);
  }

  @Override
  public void readFields(DataInput in) throws IOException {
    Occur occur = null;
    byte o = in.readByte();
    switch (o) {
    case 0:
      occur = Occur.MUST;
      break;
View Full Code Here

Examples of org.apache.lucene.search.BooleanClause.Occur

  // verify parsing of query using a stopping analyzer
  private void assertStopQueryEquals(String qtxt, String expectedRes)
      throws Exception {
    String[] fields = { "b", "t" };
    Occur occur[] = { Occur.SHOULD, Occur.SHOULD };
    TestQPHelper.QPTestAnalyzer a = new TestQPHelper.QPTestAnalyzer();
    StandardQueryParser mfqp = new StandardQueryParser();
    mfqp.setMultiFields(fields);
    mfqp.setAnalyzer(a);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.