You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Kevin Osborn <os...@yahoo.com> on 2011/06/17 01:37:55 UTC

sending results of function query to range query

I am not sure if I can use function queries this way. I have a query like this"attributeX:[* TO ?]" in my DB. I replace the ? with input from the front end. Obviously, this works fine. However, what I really want to do is "attributeX:[* TO (3 * ?)]" Is there anyway to embed the results of a function query inside the query?

Re: sending results of function query to range query

Posted by Chris Hostetter <ho...@fucit.org>.
: I am not sure if I can use function queries this way. I have a query 
: like this"attributeX:[* TO ?]" in my DB. I replace the ? with input from 
: the front end. Obviously, this works fine. However, what I really want 
: to do is "attributeX:[* TO (3 * ?)]" Is there anyway to embed the 
: results of a function query inside the query?

not really ... you'd need to do that evaluation in whatever code 
substitutes the value.

the thing people tend to forget about "function queries" and the "function 
syntax" in solr is that it's not about simple numerics -- the function is 
applied against every document, and the result is the set of scores across 
all documents, so it isn't even possibly to implement a syntax where the 
output of a function is used as the endpoint of a range, because the 
output of that function could be different for every doc.

-Hoss

Re: sending results of function query to range query

Posted by Ahmet Arslan <io...@yahoo.com>.
> I am not sure if I can use function
> queries this way. I have a query like this"attributeX:[* TO
> ?]" in my DB. I replace the ? with input from the front end.
> Obviously, this works fine. However, what I really want to
> do is "attributeX:[* TO (3 * ?)]" Is there anyway to embed
> the results of a function query inside the query?

Looks like you are looking for frange query parser plugin.

http://www.lucidimagination.com/blog/2009/07/06/ranges-over-functions-in-solr-14/