lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "G, Rajesh">
Subject RE: Facet ignoring repeated word
Date Tue, 10 May 2016 12:51:43 GMT
Thanks Toke. The issue I have is I cannot look for a specific word e.g. ddr in termfreq(%27name%27,%20%27ddr%27).
I have to find count of all words and their sum

CEB India Private Limited. Registration No: U741040HR2004PTC035324. Registered office: 6th
Floor, Tower B, DLF Building No.10 DLF Cyber City, Gurgaon, Haryana-122002, India.

This e-mail and/or its attachments are intended only for the use of the addressee(s) and may
contain confidential and legally privileged information belonging to CEB and/or its subsidiaries,
including SHL. If you have received this e-mail in error, please notify the sender and immediately,
destroy all copies of this email and its attachments. The publication, copying, in whole or
in part, or use or dissemination in any other way of this e-mail and attachments by anyone
other than the intended person(s) is prohibited.

-----Original Message-----
From: Toke Eskildsen []
Sent: Tuesday, May 10, 2016 1:52 PM
Subject: Re: Facet ignoring repeated word

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