lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Toke Eskildsen>
Subject Re: Facet ignoring repeated word
Date Tue, 10 May 2016 08:22:04 GMT
On Fri, 2016-04-29 at 08:55 +0000, G, Rajesh wrote:
> I am trying to implement word cloud<>
 using Solr.  The problem I have is Solr facet query ignores repeated words in a document

Use a combination of faceting and stats:

1) Resolve candidate words with faceting, just as you have already done.

2) Create a stats-request with the same q as you used for faceting, with
a termfreq-function for each term in your facet result.

Working example from the techproducts-demo that comes with Solr:


where 'name' is the field ('comments' in your setup) and 'ddr' and '1GB'
are two terms ('absorbed', 'am', 'believe' etc. in your setup).

The result will be something like

"response": {
    "numFound": 3,
"stats": {
    "stats_fields": {
      "termfreq('name', 'ddr')": {
        "sum": 6
      "termfreq('name', '1GB')": {
        "sum": 3

- Toke Eskildsen, State and University Library, Denmark

View raw message