Package org.apache.lucene.search

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


        String fragment = highlighter.getBestFragment(highlighter.getFieldQuery(prefixQuery),
                reader, topDocs.scoreDocs[0].doc, "content", 30);
        assertThat(fragment, nullValue());

        prefixQuery.setRewriteMethod(PrefixQuery.SCORING_BOOLEAN_QUERY_REWRITE);
        Query rewriteQuery = prefixQuery.rewrite(reader);
        fragment = highlighter.getBestFragment(highlighter.getFieldQuery(rewriteQuery),
                reader, topDocs.scoreDocs[0].doc, "content", 30);
        assertThat(fragment, notNullValue());

        System.out.println(fragment);
View Full Code Here

      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, BooleanClause.Occur.MUST);
     
      rw2 = bq.rewrite(reader);
View Full Code Here

      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

      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, BooleanClause.Occur.MUST);
     
      rw2 = bq.rewrite(reader);
View Full Code Here

      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, BooleanClause.Occur.MUST);
     
      rw2 = bq.rewrite(reader);
View Full Code Here

      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, BooleanClause.Occur.MUST);
     
      rw2 = bq.rewrite(reader);
View Full Code Here

      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

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

      }
      writer.close();
     
      reader = IndexReader.open(directory, true);
      PrefixQuery query = new PrefixQuery(new Term("category", "foo"));
      rw1 = query.rewrite(reader);
     
      BooleanQuery bq = new BooleanQuery();
      bq.add(query, BooleanClause.Occur.MUST);
     
      rw2 = bq.rewrite(reader);
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.