solrnet - Can I combine result sets in Solr -
i want following: let set of documents, each field important:true, , date beginning year, or previous year. result set should ordered date. in pseudo code:
result set a:
q="testquery" +important:true , +(date:2015* or date:2016*) sort=date desc
then, let b remaining set of documents, i.e. those important:true , date preceeding year 2015, , documents important:false. set should ordered date. again in sloppy pseudo:
result set b:
q="testquery" -(date:2015* or date:2016*) sort=date desc
now, return followed b, , able use paging features etc. noob solr ( < 10 hrs of trying out different queries) , can't figure how accomplish behavior. guess cannot use bq since don't sort score, right?
an example of desired outcome:
<result name="response" numfound="2089" start="0"> <doc> <bool name="important">true</bool> <str name="date">2016-03-01 00:00:00</str> </doc> <doc> <bool name="important">true</bool> <str name="date">2015-12-01 00:00:00</str> </doc> <doc> <bool name="important">true</bool> <str name="date">2015-04-01 00:00:00</str> </doc> <doc> <bool name="important">true</bool> <str name="date">2015-01-01 00:00:00</str> </doc> <doc> <bool name="important">false</bool> <str name="date">2016-10-01 00:00:00</str> </doc> <doc> <bool name="important">false</bool> <str name="date">2015-03-01 00:00:00</str> </doc> <doc> <bool name="important">false</bool> <str name="date">2014-02-01 00:00:00</str> </doc> <doc> <bool name="important">true</bool> <str name="date">2014-09-01 00:00:00</str> </doc> <doc> <bool name="important">false</bool> <str name="date">2013-05-01 00:00:00</str> </doc> <doc> <str name="date">2012-09-01 00:00:00</str> </doc> </result> </response>
notice in example above documents older 2015, documents marked important no more important other, appear in strict chronological order.
any appreciated, love examples using solrnet syntax :)
edit: can not make changes index or schema...
((important: true , (date:2016* or date:2015*))^1001 or (important: false , (date:2016* or date:2015*))^1000 or date:*) , something:"foo"
, sort score desc, date desc
this show recent important items first, recent non-important items, , items, , sorted date in 'sections'.
something:"foo"
@ end of clause refers clauses might have.
Comments
Post a Comment