lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Diviacco <patrick.divia...@gmail.com>
Subject Re: Am I correctly parsing the strings ? Terms or Phrases ?
Date Mon, 21 Mar 2011 17:39:31 GMT
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.diviacco@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?
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message