lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: Rephrase My Question - How To Search Database With More Than One Pair of Property/Value as Parameters Using Lucene?
Date Fri, 07 Nov 2003 09:19:48 GMT
On Friday, November 7, 2003, at 03:56  AM, Victor Hadianto wrote:
>> Nonetheless, both "creator" and the name of the
>> creator are variables.  We depend on the user to give
>
> Of course, but you don't have unlimited fields right? So you know that
> "creator" field is the creator of a book. You can provide the user with
> complicated UI but internally you can build your own query.
>
>> Query query = QueryParser.parse("creator:\"Elizabeth
>> Castro\" AND category:\"Computer Science\"",
>> "creator" AND "category",  // Is this right?
>> new StandardAnalyzer());
>> indexSearcher.search(query);
>>

I recommend against code generated String's to be QueryParse'd.  There 
are far too many fiddly issues with QueryParser (my java.net article on 
this very subject should be coming today or very very soon).  Use 
Lucene's Query API to construct queries in code - and doing so 
dynamically from a sophisticated search UI would not be that much more 
work yet would avoid several awkward issues in the parsing process.

	Erik


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


Mime
View raw message