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 "Markus Jelsma - Buyways B.V." <ma...@buyways.nl> on 2009/08/04 10:37:09 UTC

Functions in search result

Solr people,


Can i retrieve results from a function query? For instance, i have a
schema in which all documents have a size in bytes field. For each
query, i also need to sum of the bytes field for the returned documents.
I know i can use SUM as part of a function query but i cannot figure it
out if it even works for me.

I prefer doing it with Solr and have the sum in the in the response
header or somewhere similar instead of iterating over the entire
resultset myself. Also, iterating over the resultset would not really
work for me either since i also need paging through start= and rows= to
limit the show documents but still keeping the sum of bytes the same.


Regards,

-  
Markus Jelsma                  Buyways B.V.             Tel. 050-3118123
Technisch Architect            Friesestraatweg 215c     Fax. 050-3118124
http://www.buyways.nl          9743 AD Groningen        KvK  01074105


Re: Functions in search result

Posted by Grant Ingersoll <gs...@apache.org>.
On Aug 4, 2009, at 4:37 AM, Markus Jelsma - Buyways B.V. wrote:

> Solr people,
>
>
> Can i retrieve results from a function query? For instance, i have a
> schema in which all documents have a size in bytes field. For each
> query, i also need to sum of the bytes field for the returned  
> documents.
> I know i can use SUM as part of a function query but i cannot figure  
> it
> out if it even works for me.

In short, no.  However, see https://issues.apache.org/jira/browse/SOLR-1298 
  as you are not alone in wanting this.

>
> I prefer doing it with Solr and have the sum in the in the response
> header or somewhere similar instead of iterating over the entire
> resultset myself. Also, iterating over the resultset would not really
> work for me either since i also need paging through start= and rows=  
> to
> limit the show documents but still keeping the sum of bytes the same.
>
>
> Regards,
>
> -
> Markus Jelsma                  Buyways B.V.             Tel.  
> 050-3118123
> Technisch Architect            Friesestraatweg 215c     Fax.  
> 050-3118124
> http://www.buyways.nl          9743 AD Groningen        KvK  01074105
>

--------------------------
Grant Ingersoll
http://www.lucidimagination.com/

Search the Lucene ecosystem (Lucene/Solr/Nutch/Mahout/Tika/Droids)  
using Solr/Lucene:
http://www.lucidimagination.com/search


Re: Functions in search result

Posted by Chris Hostetter <ho...@fucit.org>.
: As far as I know, functions are executed on a per-document/field basis.  
: That is, I don't think any of them aggregate numeric field values from a 
: result set.

correct.

it sounds like what you are looking for is the StatsComponent...

	http://wiki.apache.org/solr/StatsComponent

: > schema in which all documents have a size in bytes field. For each
: > query, i also need to sum of the bytes field for the returned documents.
	...
: > I prefer doing it with Solr and have the sum in the in the response
: > header or somewhere similar instead of iterating over the entire
: > resultset myself. Also, iterating over the resultset would not really




-Hoss


Re: Functions in search result

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Markus,

As far as I know, functions are executed on a per-document/field basis.  That is, I don't think any of them aggregate numeric field values from a result set.

 Otis
--
Sematext is hiring -- http://sematext.com/about/jobs.html?mls
Lucene, Solr, Nutch, Katta, Hadoop, HBase, UIMA, NLP, NER, IR



----- Original Message ----
> From: Markus Jelsma - Buyways B.V. <ma...@buyways.nl>
> To: solr-user@lucene.apache.org
> Sent: Tuesday, August 4, 2009 4:37:09 AM
> Subject: Functions in search result
> 
> Solr people,
> 
> 
> Can i retrieve results from a function query? For instance, i have a
> schema in which all documents have a size in bytes field. For each
> query, i also need to sum of the bytes field for the returned documents.
> I know i can use SUM as part of a function query but i cannot figure it
> out if it even works for me.
> 
> I prefer doing it with Solr and have the sum in the in the response
> header or somewhere similar instead of iterating over the entire
> resultset myself. Also, iterating over the resultset would not really
> work for me either since i also need paging through start= and rows= to
> limit the show documents but still keeping the sum of bytes the same.
> 
> 
> Regards,
> 
> -  
> Markus Jelsma                  Buyways B.V.             Tel. 050-3118123
> Technisch Architect            Friesestraatweg 215c     Fax. 050-3118124
> http://www.buyways.nl          9743 AD Groningen        KvK  01074105