lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Miller <markrmil...@gmail.com>
Subject Re: Limiting QueryParser
Date Tue, 21 Nov 2006 23:19:55 GMT
if you scan the query and escape all colons (ie \:) then you should be 
good (I have not verified). Of course you will not be able to do a field 
search, but that seems to be what your after.

Antony Bowesman wrote:
> Hi,
>
> I have a search UI that allows search criteria to be input against 
> specific fields, e.g. Subject.
>
> In order to create a suitable Lucene Query, I must analyze that String 
> so that it becomes a set of Tokens which I can then turn into Terms.  
> QueryParser seems to fit the bill for that, however, it is too clever 
> as it assumes that anything suffixes with a : is a field reference.
>
> If someone enters
>
> important:conference agenda
>
> in the subject field, I don't want QP to translate this to
>
> +important:conference +defaultfield:agenda
>
> I want to end up with
>
> +subject:important +subject:conference +subject:agenda
>
> I've written something to do this, but I know it is not as clever as 
> QP as currently it can only create BooleanQueries with TermQueries and 
> cannot handle PhraseQuery, so would not handle
>
> important:"conference agenda"
>
> correctly.  Does anyone have any pointers on how to limit QueryParser 
> so that I can force it to treat what it thinks as fields as terms.
>
> Thanks
> Antony
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

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