Can we specifiy order of columns to search in solr?

54 Views Asked by At

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

1

There are 1 best solutions below

0
On

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.