I don't think there's any way to do this in Solr, although you could write your 
own query parser in Java if you wanted to. 

You can set "defaults" , "invariants"  and "appends" values on your request 
handler, but I don't think that's flexible enough to do what you want. 
http://wiki.apache.org/solr/SearchHandler

In general, to my perspective, Solr seems to be written assuming a trusted 
client.  If you are allowing access to untrusted clients, there are probably 
all sorts of things a client can do that you woudln't want them to, writing 
your own query parser might be a good idea. 
________________________________________
From: Paul Libbrecht [p...@hoplahup.net]
Sent: Saturday, February 19, 2011 11:01 AM
To: solr-user@lucene.apache.org
Subject: Re: Best way for a query-expander?

Hello list,

as Hoss suggests, I'll try to be more detailed.

I wish to use http parameters in my requests that define the precise semantic 
of an advanced search.
For example, if I can see from sessions, that a given user is requesting, that 
not only public resources but resources private-to-him are returned.
For example, if there's a parameter "ict", I want to expand the query with an 
extra (mandatory) term-query.

I know I could probably do this at the client level but I do not think this is 
the best way, in particular about the access to private resources... I also 
think it's better to not rely too heavily on client's ability to formula 
string-queries since it allows all sorts of tweaking that one may not wish 
possible, in particular for queries that are service oriented.

paul


Le 19 févr. 2011 à 01:18, Chris Hostetter a écrit :

>
> : I want to implement a query-expander, one that enriches the input by the
> : usage of extra parameters that, for example, a form may provide.
> :
> : Is the right way to subclass SearchHandler?
> : Or rather to subclass QueryComponent?
>
> This smells like the poster child for an X/Y problem
> (or maybe an "X/(Y OR Z)" problem)...
>
> if you can elaborate a bit more on the type of enrichment you want to do,
> it's highly likely that your goal can be met w/o needing to write a custom
> plugin (i'm thinking particularly of the multitudes of parsers solr
> already has, local params, and variable substitution)
>
> http://people.apache.org/~hossman/#xyproblem
> XY Problem
>
> Your question appears to be an "XY Problem" ... that is: you are dealing
> with "X", you are assuming "Y" will help you, and you are asking about "Y"
> without giving more details about the "X" so that we can understand the
> full issue.  Perhaps the best solution doesn't involve "Y" at all?
> See Also: http://www.perlmonks.org/index.pl?node_id=542341
>
>
> -Hoss

Reply via email to