0

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}, }

1 Answers1

1

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"
MatsLindh
  • 49,529
  • 4
  • 53
  • 84
  • thanks for the prompt response, another question, must i use pf2 and pf3 together? i have tried using just pf2, and it works – normal_user Aug 20 '19 at 10:36
  • No, they're different in how many tokens they group together at a time, i.e. `foo_bar` and `bar_baz` vs `foo_bar_baz` – MatsLindh Aug 20 '19 at 10:46
  • I see, then if my input search is just 2 words using the same example "foo_bar" then using pf3 will not work yea? – normal_user Aug 20 '19 at 10:56
  • I'm guessing it'll work when there's only two terms, but you can specify both and boost them differently. – MatsLindh Aug 20 '19 at 10:57
  • one last thing, would you have any sample on how to use the boosting on single field( based on my sample "text")? been reading the solr ref guide, but getting no where. – normal_user Aug 20 '19 at 11:34
  • I'm not sure what you mean - `pf2=text` would mean that the boosting would be applied to hits in the field `text`. – MatsLindh Aug 20 '19 at 12:21
  • oh thanks, i thought you meant the boost parameter [link](https://lucene.apache.org/solr/guide/6_6/the-extended-dismax-query-parser.html#TheExtendedDisMaxQueryParser-TheboostParameter) – normal_user Aug 21 '19 at 02:38