简体   繁体   中英

Count number of matched words in solr?

I want to count number of matched words in solr, for example:

  • Field: text: "I want to go to school every day".
  • My query: "go to today"

=> number of matched words = 2.

How can I do that? Can I setup it in solrconfig.xml? Thanks!

I don't think there is a direct way to get this.
This information, however, can be checked when you debug you query.
The debug trace would provide you with the information about the terms that matched on what fields in a document.
Debugging can be very expensive on performance though.
The same with highlighting. You can track the matched terms on the fields but it would be expensive.
You can check with experts as well on Solr Forums

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM