I want to do the following: Let A be the set of documents, each with the field important:true, and with a date beginning with this year, or previous year. The result set should be ordered by date. In pseudo code:
Result set A:
q="testquery" +important:true AND +(date:2015* OR date:2016*)
sort=date desc
Then, let B be the remaining set of documents, i.e. those with important:true and a date preceeding year 2015, and also all documents with important:false. This set should also be ordered by date. Again in very sloppy pseudo:
Result set B:
q="testquery" -(date:2015* OR date:2016*)
sort=date desc
Now, i would like to return A followed by B, and be able to use the paging features etc. I am very noob with SOLR ( < 10 hrs of trying out different queries) and I can't figure how to accomplish this behavior. I guess I cannot use bq since we don't sort by score, right?
An example of the 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 the example above that for documents older than 2015, the documents marked important is no more important than any other, they will appear in strict chronological order.
Any help is appreciated, but I would especially love examples using SolrNet syntax :)
EDIT: I can not make any changes to index or schema...
((important: true AND (date:2016* OR date:2015*))^1001 OR (important: false AND (date:2016* OR date:2015*))^1000 OR date:*) AND something:"foo"
and sort score desc, date desc
This will show recent important items first, then recent non-important items, and finally all items, and everything sorted by date in their 'sections'.
something:"foo"
at the end of the clause refers to any extra clauses you might have.