0

I have a requirement in solr to search for data in the following order for field name: exact match string begins with the word string has the exact word in it fuzzy match - for this i am using ~ operator. e.g. dave~1

The query term can have 1 or more words. Right now i am using fuzzy match operator. danny~1 boyle~1. Also i have created multiple fields for

1) exact name (the name as it is captured)
2) words in the name are captured
3) ngrams from front are generated
4) edgengram from front , middle are generated.

I am using edismax query with boost in qf.

My issue is that i want to use separate queries for different fields. Right now fuzzy search query is sent to all the fields. e.g. danny~1 boyle~1 is used across all the fields. If i can put different queries for different fields, then the problem should get solved. I tried using the 2nd suggestion at

Solr search query over multiple fields with OR. But it didn't work. Can you suggest what is wrong or any new option alltogether? My solr version is 6.6

acorntech
  • 53
  • 8
  • The easy fix: move the fuzzy match out of your query and into the suggester - that way you can give a "did you mean" suggestion instead, which may be clearer to the user - but that depends on your use case. – MatsLindh Jun 03 '18 at 08:36
  • @MatsLindh for my use i need to match to the nearest possible token , if exact match does not have any result , in a single query. any other ideas, which i can try ? – acorntech Jun 03 '18 at 09:46
  • If you only want to show any fuzzy matches _if_ there is no other hits, I'd go with two queries. – MatsLindh Jun 03 '18 at 18:05
  • How about `danny boyle OR _query_:"danny~1 boyle~1"? You might have to prefix the second `_query_` with `{!dismax ...}` and provide your `qf` again.. – MatsLindh Jun 03 '18 at 18:25
  • @MatsLindh i will try this and get back to you – acorntech Jun 04 '18 at 06:45

0 Answers0