lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: Using analyzer while constructing Lucene queries
Date Thu, 22 Jan 2009 20:04:56 GMT

: 2> Construct your queries by yourself, by using TermQuery,
: PhraseQuery etc. directly. There are no Analyzers used when
: choosing this option. You have to know what the effects of the
: Analyzer used during indexing had on the field you're searching
: and be sure you're doing something compatible.

...well, to be clear: you're writing the code, so you could use an 
Analyzer when choosing this option (and in many cases this probably makes 
a lot of sense).

The bottom line is that if you are implementing some code that takes a 
string as input, and produces a query as output you are essentially 
implementing your own query parser;  wether you implement it using an 
Analyzer or some other logic is up to you and will depend largely on the 
types of queries you aregenerating and the contents of your index.

: > What I am not really getting it how I can use the same analyzer during
: > searches is I am constructing queries manually.

call the tokenStream method of your analyzer, iterate over the tokens, 
build your query as you see fit.



-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message