Nandish
Nandish

Reputation: 125

In solr how to find no of occurrences of searched words in each document

I want to find out how many times the searched keyword repeated in each document. For Ex: search word: pharmacy related. This word may be repeated n no of times in all MATCHED documents, how to find out the COUNT per document? Please suggest me

Upvotes: 1

Views: 1623

Answers (1)

Fuxi
Fuxi

Reputation: 5488

You can do that with Solr's functions:

termfreq(text,'pharmacy related')

The only condition for that is you need to index this field correctly! In case when you need to return count of phrases rather than single words, I would use ShingleFilterFactory

Upvotes: 2

Related Questions