Re: Get fields from a Query object

2013-01-16 Thread balaji.gandhi
Hi, I am trying to do something similar:- Eg. Input: (name:John AND name:Doe) Output: ((firstName:John OR lastName:John) AND (firstName:John OR lastName:John)) How can I extract the fields, change them and repackage the query? Thanks, Balaji -- View this message in context: http://lucene

Re: Get fields from a Query object

2010-08-05 Thread Anuj Shah
Apologies Erick, missed your question. I'm on version 3.0 On Thu, Aug 5, 2010 at 11:52 AM, Anuj Shah wrote: > Having delved a bit more into the code it looks like every MultiTermQuery > descendant fails to implement the extractTerms method. This does make sense, > as it is not possible to list

Re: Get fields from a Query object

2010-08-05 Thread Anuj Shah
Having delved a bit more into the code it looks like every MultiTermQuery descendant fails to implement the extractTerms method. This does make sense, as it is not possible to list every term that satisfies a wildcard query. I also notice that most Query classes including the MultiTermQuery's, hav

Re: Get fields from a Query object

2010-08-03 Thread Erick Erickson
H. Assuming you called rewrite, I'm going to have to defer that one, I'm not familiar enough with how range queries operate. But what version of Lucene are you using? Sorry I can't be more help Erick On Tue, Aug 3, 2010 at 5:02 AM, Anuj Shah wrote: > Thanks, that does seem good in theory.

Re: Get fields from a Query object

2010-08-03 Thread Anuj Shah
Thanks, that does seem good in theory. I can get the field from each of the terms and add them to a Set to de-dupe. However, in practice queries of the following nature seems to fail with an UnsupportedOperationException: field:a* field:[a TO b] Delving into the code a bit I see the following in

Re: Get fields from a Query object

2010-08-02 Thread Erick Erickson
Did you look at Query.extractTerms? I think that'll work for you. Note that the query must be rewritten, and that the set of terms will have duplicate fields. i.e. if you search field1:Erick +field1:James I expect you'll have two terms in the set that are on field1. Best Erick On Mon, Aug 2, 2010

Re: Get fields from a Query object

2010-08-02 Thread Anuj Shah
My code has been given a query string, which we parse into the Query object and would like to get a list of fields from. I'm assuming there exists a method to do so, as it seems like a useful function. If not should I be parsing the string for fields myself. Anuj On Sun, Aug 1, 2010 at 2:21

Re: Get fields from a Query object

2010-07-31 Thread Erick Erickson
Could you explain more about what you're trying to do? You're writing the query after all, so you probably already know what went into it. Which shows that I don't understand what you want to do at all. Best Erick On Sat, Jul 31, 2010 at 9:41 AM, Anuj Shah wrote: > Hi, > > Is there a way to ge