I'm not 100% sure but my guess is that you can get the list of boolean
clauses and their "occur" (must, should, must not) and that would be
your and, or, not equivalents.



On Thu, Oct 4, 2012 at 10:39 AM, Davide Lorenzo Marino
<davide.mar...@gmail.com> wrote:
> For what I saw in the documentation from the class
> org.apache.lucene.search.Query
> I can just iterate over the terms using the method extractTerms. How can I
> extract the operators?
>
> 2012/10/4 Amit Nithian <anith...@gmail.com>
>
>> I think you'd want to start by looking at the rb.getQuery() in the
>> prepare (or process if you are trying to do post-results analysis).
>> This returns a Query object that would contain everything in that and
>> I'd then look at the Javadoc to see how to traverse it. I'm sure some
>> runtime type-casting may be necessary to get at the sub-structures
>>
>> On Thu, Oct 4, 2012 at 9:23 AM, Davide Lorenzo Marino
>> <davide.mar...@gmail.com> wrote:
>> > I don't need really start from the query String.
>> > What I need is obtain a list of terms and operators.
>> > So the real problem is:
>> >
>> > How can I access the Lucene Query structure to traverse it?
>> >
>> > Davide Marino
>> >
>> >
>> > 2012/10/4 Jack Krupansky <j...@basetechnology.com>
>> >
>> >> I'm not quite following what the issue is here. I mean, the Solr
>> >> QueryComponent generates a Lucene Query structure and you need to write
>> >> code to recursively traverse that Lucene Query structure and generate
>> your
>> >> preferred form of output. There would be no need to look at the original
>> >> query string. So, what exactly are you asking?
>> >>
>> >> Maybe you simply need to read up on Lucene Query and its subclasses to
>> >> understand what that structure looks like.
>> >>
>> >> -- Jack Krupansky
>> >>
>> >> -----Original Message----- From: Davide Lorenzo Marino
>> >> Sent: Thursday, October 04, 2012 11:36 AM
>> >> To: solr-user@lucene.apache.org
>> >> Subject: Re: Getting list of operators and terms for a query
>> >>
>> >>
>> >> It's ok.. I did it and I took the query string.
>> >> The problem is convert the java.lang.string (query) in a list of term
>> and
>> >> operators and doing it using the same parser used by Solr to execute the
>> >> queries.
>> >>
>> >> 2012/10/4 Mikhail Khludnev <mkhlud...@griddynamics.com>
>> >>
>> >>  you've got ResponseBuilder as process() or prepare() argument, check
>> >>> "query" field, but your component should be registered after
>> >>> QueryComponent
>> >>> in your requestHandler config.
>> >>>
>> >>> On Thu, Oct 4, 2012 at 6:03 PM, Davide Lorenzo Marino <
>> >>> davide.mar...@gmail.com> wrote:
>> >>>
>> >>> > Hi All,
>> >>> > i'm working in a new searchComponent that analyze the search queries.
>> >>> > I need to know if given a query string is possible to get the list of
>> >>> > operators and terms (better in polish notation)?
>> >>> > I mean if the default field is "country" and the query is the String
>> >>> >
>> >>> > "england OR (name:paul AND city:rome)"
>> >>> >
>> >>> > to get the List
>> >>> >
>> >>> > [ Operator OR, Term country:england, OPERATOR AND, Term name:paul,
>> Term
>> >>> > city:rome ]
>> >>> >
>> >>> > Thanks in advance
>> >>> >
>> >>> > Davide Marino
>> >>> >
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>> Sincerely yours
>> >>> Mikhail Khludnev
>> >>> Tech Lead
>> >>> Grid Dynamics
>> >>>
>> >>> <http://www.griddynamics.com>
>> >>>  <mkhlud...@griddynamics.com>
>> >>>
>> >>>
>> >>
>>

Reply via email to