Some of our customers want to display a "number of matches" score next to each search result. I think what they want is to list the number of matches that will be displayed when the entire document is highlighted. But this can be slow to do for every search result (some documents can be very large), so what we'd like to do is to count the number of terms that match the query for each document, and display that.

It looks like Solr's function query has some support for this - I see the termfreq function, for example. My question is:

1. Is it possible to execute the query as usual, retrieving document stored field values, and also to run a function, and return the result as the value of a computed "pseudo-field"?

2. Is there an existing function known to the function query parser that counts the total number of occurrences of all terms in the query (for the current hit document)?

-Mike

Reply via email to