1

I’m using solr 4.0 with DIH jdbc connector. I have a field named code with multiple values separated by semicolon(;). I am trying to list the search results which matches the field query(fq) to be listed at the top and remaining should be listed below. So this is not just a filter query to list only the matched query(fq) but, the matched one should be listed first and remaining results should be listed later. To be more clear, below is an example,

Let id,name,code are field names:

id=1
name=pebbles
code=465;888;256

id=2
name=paradise
code=802;326;786

id=3
name=blue sea
code=888;221

id=4
name=taj
code=123;568;332

I use Solr Admin, when I search for code:*888* in fq, like the one below,

q=*:*
fq=code:*888*   (I also tried code:[*888* TO *])

it’s listing only two records(id's 1 & 3) which ever record matches 888 in code field. But this is not what I am looking for in this case, I want it to list all(four) records with top records as fq matching records.

I want it to be listed in the following order,

id=1
name=pebbles
code=465;888;256

id=3
name=blue sea
code=888;221

id=2
name=paradise
code=802;326;786

id=4
name=taj
code=123;568;332

Anybody has any idea?. Anybody with any relevant guidance would be very much helpful!.

Thank you!

user53864
  • 1,653
  • 8
  • 36
  • 66

1 Answers1

0

It is resolved and in two ways, with OR and edismax

Solr Admin:

with OR

q=*:* OR code:*888*

(http://192.168.1.10:8983/solr/core10/select?q=*%3A*+OR+code%3A*888*&wt=xml)

with edismax

q=*:*
Check the box "edismax"
bq=code:*888*

(http://192.168.1.10:8983/solr/core10/select?q=*%3A*&wt=xml&defType=edismax&bq=code%3A*888*)
user53864
  • 1,653
  • 8
  • 36
  • 66