I think the best you can do is compute sum(pricea,priceb) at index time as a third field, say priceSum, and then you can do a range query on that priceSum field.

It would be nice to be able to have a query that evaluates arbitrary expressions combining field values, but there is no such feature in Lucene at this time. FunctionQuery modifies the document score, but doesn't affect which documents are selected.

Function queries can be used to modify document scores and to return values, but not in the query itself to select documents.

-- Jack Krupansky

-----Original Message----- From: SandroZbinden
Sent: Friday, October 04, 2013 10:21 AM
To: solr-user@lucene.apache.org
Subject: Use function return value for range queries

Is there a way to use the function return value for a range query

For example: I have two price fields pricea and priceb and now i want to get
the values where the sum of the pricea and priceb is between  [0 TO 5]

Something like *select?q={!func}sum(pricea,priceb):[0 TO 5]*

I can't calculate this at index time.

Bests Sandro





--
View this message in context: http://lucene.472066.n3.nabble.com/Use-function-return-value-for-range-queries-tp4093499.html Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to