lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian Campbell" <becamp...@hotmail.com>
Subject Re: Keyword search with space and wildcard
Date Wed, 03 Sep 2003 13:36:23 GMT
Unfortunately for me, I have done a good bit of yacc in the past.  Don't 
really wanna have to look in the class unless is absolutely necessary!   :-)

>
>Well, like Eric mentioned, if you can just ignore JavaCC syntax and look
>at embedded Java code, it's not all that complicated (especially you have
>done something with yacc/bison, to know how parser generators generally
>work)... but granted at first looks bit alien. :-)
>


I did a couple of basic tests using the WildcardQuery like below and it 
seemed to work.  I have not tried an example using the PrefixQuery and I 
doubt that I will.


>Now, I haven't tested this, but I would think that just building single 
>Query
>that searches wild card phrase "some th*" in field "my_field", you'd just 
>do:
>
>Query q = new WildcardQuery(new Term("my_field", "some th*"));
>
>and feed that to whichever search object you need. In this particular case 
>you
>could also use PrefixQuery instead; if so, you need strip out the trailing
>"*" (since that's implied when constructing PrefixQuery).
>


Because of the nature of my application I'm guaranteed to have at least one 
search term but the majority of the time it will be more then one.  So in my 
particular case, I'll almost always get a BooleanQuery back from 
QueryParser.  I'm currently working on an implementation of Eric's 
suggestion.


>
>Eric described the method of combining queries that should work as far as I
>could see. If you do not want to rely on QueryParer to return BooleanQuery,
>you can also just build your your BooleanQuery, and wrap sub-queries as
>BooleanClauses. That's bit more work but should work as well.
>

Thanks to everyone for the help.  It is much appreciated.

-Brian

_________________________________________________________________
MSN 8: Get 6 months for $9.95/month. http://join.msn.com/?page=dept/dialup


Mime
View raw message