Examples of rewrite()


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

      }
     
      if(highlightQuery != null) {
        boolean rewrite = !(Boolean.valueOf(params.get(HighlightParams.USE_PHRASE_HIGHLIGHTER, "true")) &&
            Boolean.valueOf(params.get(HighlightParams.HIGHLIGHT_MULTI_TERM, "true")));
        highlightQuery = rewrite ?  highlightQuery.rewrite(req.getSearcher().getReader()) : highlightQuery;
      }

      // No highlighting if there is no query -- consider q.alt="*:*
      if( highlightQuery != null ) {
        NamedList sumData = highlighter.doHighlighting(
View Full Code Here

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

      // For all clauses e.g. one* two~
      for (int i = 0; i < bclauses.length; i++) {
        // HashSet bclauseterms=new HashSet();
        Query qc = bclauses[i].getQuery();
        // Rewrite this clause e.g one* becomes (one OR onerous)
        qc = qc.rewrite(reader);
        if (bclauses[i].getOccur().equals(BooleanClause.Occur.MUST_NOT)) {
          numNegatives++;
        }

        if (qc instanceof BooleanQuery) {
View Full Code Here

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

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

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

        String newSuggestionQuery = originalQuery.replaceAll(":\\*?([^*]*)\\*?", ":$1");
        try {
          rwQuery = parser.parse(newSuggestionQuery);
          termset = new HashSet<Term>();
          // REWRITE NEWLY PARSED QUERY
          rwQuery = rwQuery.rewrite(reader);
          rwQuery.extractTerms(termset);
          suggestions = this.didyoumeanprovider.getSuggestionTerms(termset, this.didyoumeansuggestcount, reader);

        } catch (ParseException e) {
          log.error("Cannot Parse Suggestion Query.", e);
View Full Code Here

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

            q = query;
        } else {
            q = new RangeQuery(
                    getLowerTerm(), getUpperTerm(), inclusive, cache);
        }
        return q.rewrite(reader);
    }

    /**
     * {@inheritDoc}
     */
 
View Full Code Here

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

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

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

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

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

            }
        } finally {
            td.close();
        }
        if (similarityQuery != null) {
            return similarityQuery.rewrite(reader);
        } else {
            // return dummy query that never matches
            return new BooleanQuery();
        }
    }
View Full Code Here

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

            protected FilteredTermEnum getEnum(IndexReader reader) throws IOException {
                return new WildcardTermEnum(reader, field, tvf, 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

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

    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
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.