solrsolr-query-syntaxedismaxdismax

How to make SOLR search function return the result based on search input order


im using SOLR to perform text query on a multivalued field but its not returning as per what the input. im using edimax with standard tokenizer on the fields.

for example, i search for the text "A B C", but im getting weird order result result #1: "A C B" result #2: "A B C" result #3: "A C B"

how can i make the result #2 appear first.

sample query: localhost:8983/solr/test/select?defType=edismax&fl=text,score&mm=100%&q=A B C&qf=text

response: { "text":"A C B", "score":16.770645}, { "text":"A B C", "score":16.770645}, { "text":"A C B", "score":16.770645}, }


Solution

  • The pf2 and pf3 parameters to the edismax query parser allows you to boost documents where the terms appear in order of each other. That should work for what you need.

    Otherwise, consider using a boost query bq with the Complex Phrase Query Parser:

    bq={!complexphrase inOrder=true}text:"A B C"