lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: Limiting the fields a user can query on
Date Thu, 20 Feb 2014 05:18:56 GMT

: Is there a way to limit the fields a user can query by when using the
: standard query parser or a way to get all fields/terms that make up a query
: without writing custom code for each query subclass?

"limit" in what way?  do you want to throw a parse error if they give you 
"field_you_do_not_allow:foo*" or do you want to treat th entire string 
(including the colon) as a prefix? or do you want to ignore the clause 

depending on your goal, you could subclass the QueryParser and override 
the various methods to throw and exception (or change what query gets 
produced) based on the field name passed to you -- or you could use an 
IndexReader wrapper that hides the existence of the terms in the fields 
you don't want to allow so the queries re-write to no-ops.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message