search - Solr to list partial matches at top-different scenario -


i have performed search against field company (**which ngram-d need fetch results against partial match)** search text "aetnahmo" . bring exact matches , partial matches top. need handle scenario such as: example: below results, need bring "aetna better hlth pahmo" , "aetna better health mahmo" @ top of "cignahmo healthplan - meth". here,even these results not have 'aetnahmo' has 'aetna'. need display results starts this, below exact matches , similar matches.

  "docs": [   {     "company": "aetnahmognpipa",     "score": 0.32741508   },   {     "company": "aetnahmoposout of network",     "score": 0.32741508   },   {     "company": "cignahmo healthplan - meth",     "score": 0.14788051   },   {     "company": "cignahmoposoz08",     "score": 0.14500062   },   {     "company": "cignahmoposgnpipa",     "score": 0.14500062   },   {     "company": "humanahmo mcd",     "score": 0.14500062   },   {     "company": "aetna better hlth pahmo",     "score": 0.1069743   },   {     "company": "aetna better health mahmo",     "score": 0.1069743   },   {     "company": "molina hlthcare il pahmo",     "score": 0.067287326   },   {     "company": "bcbsmahmo outpt",     "score": 0.065203   }   ] 

is there way achieve this. please help

phrase boosting work here.

you'll need use edismax query parser along pf field.

the following params appended query should trick: &deftype=edismax&pf=company.

i've tested out on solr-5.4.1 dataset you've posted above , results follows:

query: http://localhost:8983/solr/test/select?q=company%3aaetnamho&wt=json&indent=true&deftype=edismax&pf=company&stopwords=true&lowercaseoperators=true&omitheader=true

response:

{ "response":{"numfound":9,"start":0,"docs":[   {     "company":"aetnahmoposout of network",     "id":2,     "_version_":1530885533005250560},   {     "company":"aetna better health mahmo",     "id":8,     "_version_":1530885600368918528},   {     "company":"aetna better hlth pahmo",     "id":7,     "_version_":1530885592734236672},   {     "company":"aetnahmognpipa",     "id":1,     "_version_":1530885512290631680},   {     "company":"cignahmo healthplan - meth",     "id":3,     "_version_":1530885543046414336},   {     "company":"molina hlthcare il pahmo",     "id":9,     "_version_":1530885608894889984},   {     "company":"cignahmoposgnpipa",     "id":5,     "_version_":1530885565434560512},   {     "company":"cignahmoposoz08",     "id":4,     "_version_":1530885555631423488},   {     "company":"humanahmo mcd",     "id":6,     "_version_":1530885585061806080}] }} 

Comments