There are two problems in the code (and they have nothing to do with your version of Lucene):
1) StandardAnalyzer does not index stop words (for example, "in"), so PhraseQuery will never be able to find the phrase "Lucene in"
2), Xodarap Shashikant Kore, Index.ANALYZED, Lucene . , Index.NOT_ANALYZED, .
addDoc :
public static void addDoc(IndexWriter w, String value)throws IOException{
Document doc = new Document();
doc.add(new Field("content", value, Field.Store.YES, Field.Index.ANALYZED));
w.addDocument(doc);
}
PhraseQuery :
PhraseQuery pq = new PhraseQuery();
pq.add(new Term("content", "computer"),0);
pq.add(new Term("content", "science"),1);
pq.setSlop(0);
, "" "" :
Found 1 hits.
1.The Art of Computer Science
"Lucene in Action", PhraseQuery ( "" ):
PhraseQuery pq = new PhraseQuery();
pq.add(new Term("content", "lucene"),0);
pq.add(new Term("content", "action"),1);
pq.setSlop(1);
"lucene in", (, SimpleAnalyzer). Lucene 2.9 StandardAnalyzer :
SimpleAnalyzer analyzer = new SimpleAnalyzer();
, 3.1 , :
SimpleAnalyzer analyzer = new SimpleAnalyzer(Version.LUCENE_35);
( PhraseQuery):
Lucene? - . WhiteFang34.