lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vaasu <sriniva...@aztecsoft.com>
Subject Re: Creating parser query "by hand"
Date Fri, 01 Jun 2007 06:11:53 GMT

Hi,


I am working on search using lucene2.0.0.

My requirement is to construct a lucene query in the form of string
(+contents:java programming +author:xxx) and then this is used to construct
lucene query so that it can be searched using lucene searcher. I want to
know, how to convert String query into lucene Query? so that it can be
searchable. 

is this possible? I will be thankful if you can send any samples for this.

Thanks,
Vaasu.



Erik Hatcher wrote:
> 
> 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: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Creating-parser-query-%22by-hand%22-tf261639.html#a10907265
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
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