Package org.apache.lucene.search

Examples of org.apache.lucene.search.Query.rewrite()


   * rangeQueries that don't summarize the document
   */
  private static Query rewrite(Query original) throws IOException {
    Query query = original;
    for (Query rewrittenQuery = query.rewrite(EMPTY_INDEXREADER); rewrittenQuery != query;
         rewrittenQuery = query.rewrite(EMPTY_INDEXREADER)) {
      query = rewrittenQuery;
    }
    return query;
  }
 
View Full Code Here


      if (transform == TRANSFORM_NONE)
      {
         Query stdRangeQueryImpl = new org.apache.lucene.search.RangeQuery(lowerTerm, upperTerm, inclusive);
         try
         {
            stdRangeQuery = stdRangeQueryImpl.rewrite(reader);
            return stdRangeQuery;
         }
         catch (BooleanQuery.TooManyClauses e)
         {
            log.debug("Too many terms to enumerate, using custom RangeQuery");
View Full Code Here

            protected FilteredTermEnum getEnum(IndexReader reader) throws IOException {
                return new WildcardTermEnum(reader, field, propName, pattern, transform);
            }
        };
        try {
            multiTermQuery = stdWildcardQuery.rewrite(reader);
            return multiTermQuery;
        } catch (BooleanQuery.TooManyClauses e) {
            // MultiTermQuery not possible
            log.debug("Too many terms to enumerate, using custom WildcardQuery.");
            return this;
View Full Code Here

            }
        } finally {
            td.close();
        }
        if (similarityQuery != null) {
            return similarityQuery.rewrite(reader);
        } else {
            // return dummy query that never matches
            return new TermQuery(new Term(FieldNames.UUID, "x"));
        }
    }
View Full Code Here

    public Query rewrite(IndexReader reader) throws IOException {
        if (transform == TRANSFORM_NONE) {
            Query stdRangeQueryImpl
                    = new org.apache.lucene.search.RangeQuery(lowerTerm, upperTerm, inclusive);
            try {
                stdRangeQuery = stdRangeQueryImpl.rewrite(reader);
                return stdRangeQuery;
            } catch (BooleanQuery.TooManyClauses e) {
                log.debug("Too many terms to enumerate, using custom RangeQuery");
                // failed, use own implementation
                return this;
View Full Code Here

    public Query rewrite(IndexReader reader) throws IOException {
        if (transform == TRANSFORM_NONE) {
            Query stdRangeQueryImpl
                    = new org.apache.lucene.search.RangeQuery(lowerTerm, upperTerm, inclusive);
            try {
                stdRangeQuery = stdRangeQueryImpl.rewrite(reader);
                return stdRangeQuery;
            } catch (BooleanQuery.TooManyClauses e) {
                log.debug("Too many terms to enumerate, using custom RangeQuery");
                // failed, use own implementation
                return this;
View Full Code Here

      {
         td.close();
      }
      if (similarityQuery != null)
      {
         return similarityQuery.rewrite(reader);
      }
      else
      {
         // return dummy query that never matches
         return new TermQuery(new Term(FieldNames.UUID, "x"));
View Full Code Here

            return new WildcardTermEnum(reader, field, propName, pattern, transform);
         }
      };
      try
      {
         multiTermQuery = stdWildcardQuery.rewrite(reader);
         return multiTermQuery;
      }
      catch (BooleanQuery.TooManyClauses e)
      {
         // MultiTermQuery not possible
View Full Code Here

  {
      Query q=parse("FuzzyLikeThisQuery.xml");
      //show rewritten fuzzyLikeThisQuery - see what is being matched on
      if(printResults)
      {
        System.out.println(q.rewrite(reader));
      }
      dumpResults("FuzzyLikeThis", q, 5);
  }
  public void testTermsFilterXML() throws Exception
  {
View Full Code Here

   * we rewrite against an empty indexreader: as we don't want things like
   * rangeQueries that don't summarize the document
   */
  private static Query rewrite(Query original) throws IOException {
    Query query = original;
    for (Query rewrittenQuery = query.rewrite(EMPTY_INDEXREADER); rewrittenQuery != query;
         rewrittenQuery = query.rewrite(EMPTY_INDEXREADER)) {
      query = rewrittenQuery;
    }
    return query;
  }
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.