简体   繁体   中英

Return Solr documents with maximum intersection in a multivalued field

Consider the following solr document.

 {
     "id":"71850",
     "title":"Blah Blah Blah",
     "tags":["Lifestyle","Relationship","Social Wellness"],
     "_version_":1557041802828054529
  }

The document represents a blog post and a few tags associated with it. The problem I am trying to solve is to get the most relevant documents to a given blog post based on maximum tags intersection.

Here tags is a multivalued field.

The documents having more intersection should be ordered higher in the result.For example the documents with 3 tag matches should appear higher than the ones which have 2 tag matches and so on.

Any suggestion would be helpful.

can you try the following query:

http://localhost:8983/solr/core1/select?q= "Lifestyle" "Relationship" "Social Wellness"&qf=tags

Maybe this fits your needs.

Best regards, ewatch

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