lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Grantham <>
Subject Re: Restricting the searchable fields
Date Fri, 24 Feb 2006 12:16:27 GMT
Thanks Erik, I'll give it a go and let you know how I get on.  I suppose 
it's a bit of a wierd request but it's a requirement on the project I'm 
working on.

Erik Hatcher wrote:
> On Feb 24, 2006, at 6:26 AM, Richard Grantham wrote:
>> Query query = MultiFieldQueryParser.parse(queryString, searchFields,
>>     new StandardAnalyzer());
>> This mostly works.  The point where it falls down is when you  specify 
>> a field I want prohibited in the query string.  Eg.  searching for 
>> 'london' will fail, but searching for  'address:london' will return 
>> results.
>> Can anyone recommend a method that might achieve what I want?  I  
>> really don't want standard users to be able to search on address, etc.
> If you are handing a user-typed String to (MultiField)QueryParser you  
> cannot, be default, prevent any indexed fields from being searched.   
> You could, however, create custom QueryParser and  MultiFieldQueryParser 
> subclasses that could prevent this, I believe,  by overriding all the 
> various get* methods that return a Query and  block specific fields as 
> desired.  I'm not quite sure of the details  and am just mentioning this 
> off the top of my head, so maybe there  are some issues I haven't 
> considered that make this tougher than just  that.
>     Erik
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message