Examples of rewrite()


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

      writer.close();
     
      IndexReader reader = IndexReader.open(directory);
      PrefixQuery query = new PrefixQuery(new Term("category", "foo"));
     
      rw1 = query.rewrite(reader);
     
      BooleanQuery bq = new BooleanQuery();
      bq.add(query, true, false);
     
      rw2 = bq.rewrite(reader);
View Full Code Here

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

        if (readerDir != null)
        {
          IndexReader     reader = IndexReader.open(readerDir);
          SimpleHTMLFormatter formatter = new SimpleHTMLFormatter("<span class=\"highlighted\">", "</span>");

          mHighlighter = new Highlighter(formatter, new QueryScorer(query.rewrite(reader)));
        }
        else
        {
          throw new IOException("Couldn't find the correct index directory for this bot, channel, and server combination");
        }
View Full Code Here

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

      String queryString = QUERY;
      QueryParser parser=new QueryParser(FIELD_NAME, /*new StandardAnalyzer()/*/XFactory.getWriterAnalyzer());
      Query query = parser.parse(queryString);
      System.out.println(query);
      Searcher searcher = new IndexSearcher(ramDir);
      query = query.rewrite(reader);
      System.out.println(query);
      System.out.println("Searching for: " + query.toString(FIELD_NAME));
      Hits hits = searcher.search(query);
     
      BoldFormatter formatter = new BoldFormatter();
View Full Code Here

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

    IndexReader reader = IndexReader.open(ramDir);
    String queryString = QUERY;
    QueryParser parser = new QueryParser(Version.LUCENE_CURRENT, FIELD_NAME, analyzer);
    Query query = parser.parse(queryString);
    Searcher searcher = new IndexSearcher(ramDir);
    query = query.rewrite(reader);
    System.out.println("Searching for: " + query.toString(FIELD_NAME));
    TopDocs hits = searcher.search(query, 10);

    BoldFormatter formatter = new BoldFormatter();
    Highlighter highlighter = new Highlighter(formatter, new QueryScorer(
View Full Code Here

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

    IndexReader reader = IndexReader.open(ramDir);
    String queryString = QUERY;
    QueryParser parser = new QueryParser(Version.LUCENE_CURRENT, FIELD_NAME, analyzer);
    Query query = parser.parse(queryString);
    Searcher searcher = new IndexSearcher(ramDir);
    query = query.rewrite(reader);
    System.out.println("Searching for: " + query.toString(FIELD_NAME));
    TopDocs hits = searcher.search(query, 10);   

    BoldFormatter formatter = new BoldFormatter();
    Highlighter highlighter = new Highlighter(formatter, new QueryScorer(
View Full Code Here

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

    IndexReader reader = IndexReader.open(ramDir);
    String queryString = QUERY;
    QueryParser parser = new QueryParser(Version.LUCENE_CURRENT, FIELD_NAME, analyzer);
    Query query = parser.parse(queryString);
    Searcher searcher = new IndexSearcher(ramDir);
    query = query.rewrite(reader);
    System.out.println("Searching for: " + query.toString(FIELD_NAME));
    TopDocs hits = searcher.search(query, 10);   

    BoldFormatter formatter = new BoldFormatter();
    Highlighter highlighter = new Highlighter(formatter, new QueryScorer(
View Full Code Here

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

    IndexReader reader = IndexReader.open(ramDir);
    String queryString = QUERY;
    QueryParser parser = new QueryParser(Version.LUCENE_CURRENT, FIELD_NAME, analyzer);
    Query query = parser.parse(queryString);
    Searcher searcher = new IndexSearcher(ramDir);
    query = query.rewrite(reader);
    System.out.println("Searching for: " + query.toString(FIELD_NAME));
    TopDocs hits = searcher.search(query, 10);

    BoldFormatter formatter = new BoldFormatter();
    Highlighter highlighter = new Highlighter(formatter, new QueryScorer(
View Full Code Here

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

    IndexReader reader = IndexReader.open(ramDir);
    String queryString = QUERY;
    QueryParser parser = new QueryParser(Version.LUCENE_CURRENT, FIELD_NAME, analyzer);
    Query query = parser.parse(queryString);
    Searcher searcher = new IndexSearcher(ramDir);
    query = query.rewrite(reader);
    System.out.println("Searching for: " + query.toString(FIELD_NAME));
    TopDocs hits = searcher.search(query, 10);

    BoldFormatter formatter = new BoldFormatter();
    Highlighter highlighter = new Highlighter(formatter, new QueryScorer(
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 {
                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, transform);
            }
        };
        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
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.