On Wed, 2007-08-22 at 23:18 -0700, Chris Hostetter wrote:
> : in my custom request handler, I want to determine which fields are
> : constrained by the user.
> :
> : E.g. the query (q) might be "ipod AND brand:apple" and there might
> : be a filter query (fq) like "color:white" (or more).
> :
> : What I want to know is that "brand" and "color" are constrained.
> 
> technically the "ipod" keyword is field constrained as well, using the
> defaultSerachField.
> 
> : AFAICS I could use SolrPluginUtils.parseFilterQueries and test
> : if the queries are TermQueries and read its Field.
> : Then should I also test which kind of queries I get when parsing
> : the query (q) and look for all TermQueries from the parsed query?
> 
> are you specificly only interested in TermQueries? 
Probably I'm also interested in PrefixQueries, as they also provide a
Term, e.g. parsing "ipod AND brand:apple" gives a PrefixQuery for
"brand:apple".

>  wouldn't a range query
> also be a user constraint?
Yes, then I'm also interested in RangeQueries.

> 
> : Or is there a more elegant way of doing this?
> 
> it's hard to be sure without a better understanding of exactly what your
> custom handler needs to do, 
I want to do s.th. like "dynamic faceting" - so that the solr client
does not have to request facets via facet.field, but that I can decide
in my CustomRequestHandler which facets are returned. But I want to
return only facets for fields that are not already constained, e.g.
when the query contains s.th. like "brand:apple" I don't want to return
a facet for the field "brand".

> but my best guess is a custom QueryParser that
> records all the FieldNames it sees when parsing.
Ok, so I would override getFieldQuery, getPrefixQuery, getRangeQuery and
getWildcardQuery(?) and record the field names? And I would use this
QueryParser for both parsing of the query (q) and the filter queries
(fq)?

Thanx && cheers,
Martin


> 
> 
> 
> -Hoss
> 

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to