Try asking the question on the Lucene user list - this is the Solr user list.

Also, clarify whether you are trying to get the list of fields used in a query or trying to limit the fields that can be used in a query. uf does the latter, but your latest message suggested the former. You're confused us - or at least me!

Look at how "uf" is implemented in Solr and then just replicate that in the Lucene standard query parser. The solr standard query parser was originally just a subclass of the Lucene standard query parser, but then they diverged and Solr now has a copy of the Lucene query parser.

-- Jack Krupansky

-----Original Message----- From: Jamie Johnson
Sent: Wednesday, February 19, 2014 8:05 PM
To: solr-user@lucene.apache.org ; Ahmet Arslan
Subject: Re: Getting fields from query

On closer inspection this isn't quite what I'm looking for. The
functionality is spot on, but I'm looking for a way to do this using a
Query Parser in Lucene core, i.e. StandardQueryParser unless folks have
experience with using the Solr query parsers with vanilla lucene?  Though
I'd prefer to stick to just Lucene.

If there was a way to just get all of the fields that were part of a query
I could easily do this myself, but it looks as if there is no standard way
to get a field given a query i.e. TermQuery you need to getTerm, SpanQuery
you get field, BooleanQuery you need to check all the clauses, etc.  It's
definitely possible for me to go through each of these and determine the
proper way to do it, but I'd have thought that this was something already
done as a utility somewhere.  I had thought that the
Query.extractTerms(Set<Term> terms) would have done this, but it doesn't
appear to be implemented for range queries.  Any ideas how I can get this
information?


On Wed, Feb 19, 2014 at 7:37 PM, Jamie Johnson <jej2...@gmail.com> wrote:

This actually may do what I want, I'll have to check.  Right now we are
using Lucene directly and not Solr for this particular project, but if this
fits the bill we may be able to use just the query parser.


On Wed, Feb 19, 2014 at 4:30 PM, Ahmet Arslan <iori...@yahoo.com> wrote:

Hi Jamie,

May not be direct answer to your question but your Q reminded me
edismax's uf parameter.

http://wiki.apache.org/solr/ExtendedDisMax#uf_.28User_Fields.29





On Wednesday, February 19, 2014 11:18 PM, Jamie Johnson <
jej2...@gmail.com> wrote:
Is there a way to get all the fields that are in a particular query?
Ultimately I'd like to restrict the fields that a user can use to search
so I want to make sure that there aren't any fields in the query that they
should not be allowed to search.




Reply via email to