lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bernd Fehling <bernd.fehl...@uni-bielefeld.de>
Subject Re: howto add custom QueryParser stage or filter
Date Wed, 04 May 2011 13:56:12 GMT
Hi Erik,

Am 04.05.2011 14:30, schrieb Erick Erickson:
> Sure, all you have to do is derive from "the right class". See:
> http://wiki.apache.org/solr/SolrPlugins#QParserPlugin
>
> But this'll be tricky since you have to get at the proper colons in your
> example, and not remove the ones that delimit fields....
>
> Might it be easier to clean the search terms in the app before
> assembling the Solr query?

There are many applications using my index and more to come.
I thought about some kind of making the QueryParser more "foolproof",
may be via regex or filetring. But you are right, very tricky.

Actually the number of "illegal" queries is very low.
May be it is possible to catch an exception somewhere and give
a clean 0 hits result page back instead of an error page or dump.
Do you have any idea how to realize this?

Would be pleased to have some kind of QueryValidator which first
parses/validates the query and if the query is valid starts the search,
otherwise refuses the search and gives 0 hits with status "illegal query".
Just a rough idea.

Regards
Bernd

>
> Best
> Erick
>
> On Wed, May 4, 2011 at 6:32 AM, Bernd Fehling
> <bernd.fehling@uni-bielefeld.de>  wrote:
>> Dear list,
>>
>> is it possible to add a custom QueryParser stage to solr
>> or add a custom query filter?
>>
>> My aim is to filter out reserved characters from query terms,
>> like ":" within a query term.
>>
>> query=text:(:foo AND bar)
>> query=text:(foo AND b:ar)
>>
>> Regards
>> Bernd
>>

Mime
View raw message