You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by sergiu gordea <gs...@ifit.uni-klu.ac.at> on 2004/10/07 11:55:06 UTC
Re: *term search
iouli.golovatyi@group.novartis.com wrote:
>.. and here is the way to do it:
>(See attached file: SUPPOR~1.RAR)
>
>
Hi all,
I got from iouli the solution to enable prefix queries (*term). In fact
you can find the solution in
lucene source, in QueryParser.jj is said in a comment how to enable
prefix queries.
I did so ... but I found a lot of bugs. If you define WildTerm as
| <WILDTERM: (<_TERM_CHAR> | ( [ "*", "?" ] ))* >
a lot of constructions will be validated, and you will get a lot of
errors ...
for example "----" and "+++++" are considered valid, * is considered
valid, and they generate TooManyBooleanClausesExceptions,
I' not very good in creating regular expressions but I succesfully use
the following construction ..
| <WILDTERM: (<_TERM_START_CHAR> (<_TERM_CHAR> | ( [ "*", "?" ] ))* )
| ( [ "*", "?" ] <_TERM_START_CHAR> (<_TERM_CHAR> |
( [ "*", "?" ] ) )* ) >
Can anyone improve the construction and update the comment in
QueryParser.jj?
Thanks a lot,
Sergiu
>
>
>
> Erik Hatcher
> <erik@ehatchersol To: "Lucene Users List"
> utions.com> <lu...@jakarta.apache.org>
> cc: (bcc: Iouli Golovatyi/X/GP/Novartis)
> 08.09.2004 12:46 Subject: Re: *term search
> Please respond to
> "Lucene Users Category: |-------------------------|
> List" | ( ) Action needed |
> | ( ) Decision needed |
> | ( ) General Information |
> |-------------------------|
>
>
>
>
>
>
>On Sep 8, 2004, at 6:26 AM, sergiu gordea wrote:
>
>
>>I want to discuss a little problem, lucene doesn't support *Term like
>>queries.
>>
>>
>
>First of all, this is untrue. WildcardQuery itself most definitely
>supports wildcards at the beginning.
>
>
>
>>I would like to use "*schreiben".
>>
>>
>
>The dilemma you've encountered is that QueryParser prevents queries
>that begin with a wildcard.
>
>
>
>>So my question is if there is a simple solution for implementing the
>>funtionality mentioned above.
>>Maybe subclassing one class and overwriting some methods will sufice.
>>
>>
>
>It will require more than that in this case. You will need to create a
>custom parser that allows the grammar you'd like. Feel free to use the
>JavaCC source code to QueryParser as a basis of your customizations.
>
> Erik
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>
>
>
>
>
>
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org