One more thing: It is actually not clear to me how to use PhraseQuery... I thought I can just pass a phrase to it, but I see only add(Term) method... should I parse the string by myself to single terms ?
On 21 March 2011 18:05, Patrick Diviacco <patrick.divia...@gmail.com> wrote: > >> If description field is tokenized/analyzed during indexing you need to use >> PhraseQuery. >> > > Uhm yeah I'm using a WhitespaceAnalyzer. This is the code using for > indexing: > > writer = new IndexWriter(FSDirectory.open(INDEX_DIR), new > IndexWriterConfig(org.apache.lucene.util.Version.LUCENE_40, new > WhitespaceAnalyzer(org.apache.lucene.util.Version.LUCENE_40))); > ... > document.add(new Field("description", flickrDoc.getDescription(), > Field.Store.YES, Field.Index.ANALYZED)); > ... > writer.addDocument(document); > > > > May you can use QueryParser instead? >> >> Why ? Can't I just use PhraseQuery ? What is QueryParser for? >