Package org.apache.lucene.search.spans

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


    return new SpanNearQuery(new SpanQuery[] { s, m, e }, slop, inOrder);
  }
 
  /** MACRO for SpanFirst(SpanTermQuery) */
  public SpanFirstQuery sf(String s, int b) {
    return new SpanFirstQuery(st(s), b);
  }
View Full Code Here


    return new SpanNearQuery(new SpanQuery[] { s, m, e }, slop, inOrder);
  }
 
  /** MACRO for SpanFirst(SpanTermQuery) */
  public SpanFirstQuery sf(String s, int b) {
    return new SpanFirstQuery(st(s), b);
  }
View Full Code Here

  {
      int end=DOMUtils.getAttribute(e,"end",1);
      Element child=DOMUtils.getFirstChildElement(e);
      SpanQuery q=factory.getSpanQuery(child);
     
    SpanFirstQuery sfq = new SpanFirstQuery(q,end);
   
    sfq.setBoost(DOMUtils.getAttribute(e,"boost",1.0f));
    return sfq;
  }
View Full Code Here

  private static Query[] getPrebuiltQueries(String field) {
    WildcardQuery wcq = new WildcardQuery(new Term(field, "fo*"));
    wcq .setRewriteMethod(MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE);
    // be wary of unanalyzed text
    return new Query[] {
        new SpanFirstQuery(new SpanTermQuery(new Term(field, "ford")), 5),
        new SpanNearQuery(new SpanQuery[] {
            new SpanTermQuery(new Term(field, "night")),
            new SpanTermQuery(new Term(field, "trading")) }, 4, false),
        new SpanNearQuery(new SpanQuery[] {
            new SpanFirstQuery(new SpanTermQuery(new Term(field, "ford")), 10),
            new SpanTermQuery(new Term(field, "credit")) }, 10, false), wcq, };
  }
View Full Code Here

  };
 
  private static Query[] getPrebuiltQueries(String field) {
    //  be wary of unanalyzed text
    return new Query[] {
        new SpanFirstQuery(new SpanTermQuery(new Term(field, "ford")), 5),
        new SpanNearQuery(new SpanQuery[]{new SpanTermQuery(new Term(field, "night")), new SpanTermQuery(new Term(field, "trading"))}, 4, false),
        new SpanNearQuery(new SpanQuery[]{new SpanFirstQuery(new SpanTermQuery(new Term(field, "ford")), 10), new SpanTermQuery(new Term(field, "credit"))}, 10, false),
        new WildcardQuery(new Term(field, "fo*")),
    };
  }
View Full Code Here

    return new SpanNearQuery(new SpanQuery[] { s, m, e }, slop, inOrder);
  }
 
  /** MACRO for SpanFirst(SpanTermQuery) */
  public SpanFirstQuery sf(String s, int b) {
    return new SpanFirstQuery(st(s), b);
  }
View Full Code Here

    writer.optimize();
    writer.close();

    IndexSearcher searcher = new IndexSearcher(directory);
    SpanRegexQuery srq = new SpanRegexQuery(new Term("field", "aut.*"));
    SpanFirstQuery sfq = new SpanFirstQuery(srq, 1);
    // SpanNearQuery query = new SpanNearQuery(new SpanQuery[] {srq, stq}, 6,
    // true);
    Hits hits = searcher.search(sfq);
    assertEquals(1, hits.length());
  }
View Full Code Here

  private static Query[] getPrebuiltQueries(String field) {
    WildcardQuery wcq = new WildcardQuery(new Term(field, "fo*"));
    wcq .setRewriteMethod(MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE);
    // be wary of unanalyzed text
    return new Query[] {
        new SpanFirstQuery(new SpanTermQuery(new Term(field, "ford")), 5),
        new SpanNearQuery(new SpanQuery[] {
            new SpanTermQuery(new Term(field, "night")),
            new SpanTermQuery(new Term(field, "trading")) }, 4, false),
        new SpanNearQuery(new SpanQuery[] {
            new SpanFirstQuery(new SpanTermQuery(new Term(field, "ford")), 10),
            new SpanTermQuery(new Term(field, "credit")) }, 10, false), wcq, };
  }
View Full Code Here

  };
 
  private static Query[] getPrebuiltQueries(String field) {
    //  be wary of unanalyzed text
    return new Query[] {
        new SpanFirstQuery(new SpanTermQuery(new Term(field, "ford")), 5),
        new SpanNearQuery(new SpanQuery[]{new SpanTermQuery(new Term(field, "night")), new SpanTermQuery(new Term(field, "trading"))}, 4, false),
        new SpanNearQuery(new SpanQuery[]{new SpanFirstQuery(new SpanTermQuery(new Term(field, "ford")), 10), new SpanTermQuery(new Term(field, "credit"))}, 10, false),
        new WildcardQuery(new Term(field, "fo*")),
    };
  }
View Full Code Here

    return new SpanNearQuery(new SpanQuery[] { s, m, e }, slop, inOrder);
  }
 
  /** MACRO for SpanFirst(SpanTermQuery) */
  public SpanFirstQuery sf(String s, int b) {
    return new SpanFirstQuery(st(s), b);
  }
View Full Code Here

TOP

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

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.