Sorry, but there is no such feature in Solr at this time - you would have to
do it manually, either by retrieving all of the results or by writing a
custom "value source" (function) that does the desired calculation within
Solr.
Feel free to file a Jira for suggesting such a new feature/improvement.
-- Jack Krupansky
-----Original Message-----
From: Tony Mullins
Sent: Thursday, July 04, 2013 9:45 AM
To: solr-user@lucene.apache.org
Subject: Total Term Frequency per ResultSet in Solr 4.3 ?
Hi ,
I have lots of crawled data, indexed in my Solr (4.3.0) and lets say user
creates a search criteria 'X1' and he/she wants to know the occurrence of a
specific term in the result set of that 'X1' search criteria.
And then again he/she creates another search criteria 'X2' and he/she wants
to know the occurrence of that same term in the result set of that 'X2'
search criteria.
At the moment if I give termfreq(field,term) then it gives me the term
frequency per document and if I use totaltermfreq(field,term), it gives me
the total term frequency in entire index not in the result set of my search
criteria.
So what I need is your help to find how to how to get total occurrence of a
term in query's result set.
If this is my result set
<doc>
<str name="type">Movies</str>
<str name="format">dvd</str>
<str name="product">The Hunger Games</str></doc>
<doc>
<str name="type">Books</str>
<str name="format">paperback</str>
<str name="product">The Hunger Book</str></doc>
And I am looking for term 'hunger' in product field then I want to get
value = '2' , and if I am searching for term 'games' in product field I
want to get value = '1' .
Thanks,
Tony