On Aug 29, 2005, at 9:05 AM, Markus Fischer wrote:
I currently pass the search tokens as Vector to my query function
and construct the string to pass to the QueryParse.parse() by hand.
StringBuffer qStr = new StringBuffer();
qStr.append("title:" + queryString.trim() + "^7 ");
[...]
and this append for every field I want to search in.
When I started with lucene I had found a site saying that the
performance would be better to craft the query token by hand and
not having QueryParse.parse() parse my string again when I've
already everything to built the tokens myself.
Unfortuantely I can't find this site again and I can't find an
example on how it works to actually create the tokens myself and
pass them to the searcher.
Any help would be appriciated.
Whether you parse or not in this case depends on whether the tokens
in the Vector are exactly the tokens you indexed or not. If they
are, then you could create a BooleanQuery, construct a TermQuery for
each token and add it to the BooleanQuery. Eliminating the use of
QueryParser when not needed may not be a performance booster, but it
certainly eliminates a source of confusion or unexpected queries
because of QP morphing them via parsing and analysis.
Erik
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]