0

Can we specify order of columns to be searched in solr?

For example my search string is : "Test" Then my result should contain all rows matching column1 and then all rows matching column 2... Similar to union query in SQL.

I tried with custom search handler which will fire multiple requests to solr and then append to get final result. But is there any other way to get this type of search using SOLR?

I am using solr-5.4.1.

Thanks

user1097437
  • 111
  • 3
  • 12
  • I am not sure if I understand you right. Did you have a look into the Dismax or eDismax query handler? Is this what you want to do? – cheffe Feb 26 '16 at 06:28
  • What do you mean when you say columns? Are you referring to fields of a document? – Binoy Dalal Feb 26 '16 at 09:33

1 Answers1

0

You could use eDismax and match on both fields (I assume you mean columns by that). Then, use boosting to prioritize the matches in the first field to rank higher.

As an easy example, you would search against field1^10 field2, where ^10 is the boost factor. If that works but is not perfect, you can look into the documentation for other methods to apply boost.

Alexandre Rafalovitch
  • 9,709
  • 1
  • 24
  • 27