Can you do sorting and grouping for the search results in solr using the solr config files? -
assume indexed fields includes: product name product type product release date
assume solr request handler type dismax.
is possible sort , group search results in solr search engine using solr config files, schema.xml , solrconfig.xml?
for example, when search spider man, if search results came products of spider man dvds , spider man comic books, , mixed 1 after this: spiderman1, dvd spiderman1, book spiderman2, book spiderman3, dvd spiderman4, book
is possible group results, dvds next each other , books next each other using solr config files? if yes, can give example of how it?
also possible sort result putting recent released dvds , books show on top of result using solr sonfig files? if yes, can give example of how it?
solr supports grouping (also called field collapsing) allow group results per product type.
configuration can added default request handler defination in solrconfig.xml applied always.
<requesthandler name="/browse" class="solr.searchhandler"> <lst name="defaults"> <!-- query settings --> <str name="deftype">edismax</str> <str name="qf"> text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4 title^10.0 description^5.0 keywords^5.0 author^2.0 resourcename^1.0 </str> <str name="df">text</str> <str name="mm">100%</str> <str name="q.alt">*:*</str> <str name="rows">10</str> <str name="fl">*,score</str> <!-- faceting defaults --> <str name="group">true</str> <str name="group.field">product_type</str> ................... </lst> </requesthandler>
the group configuration defined defaults , can overridden passing parameters.
there 2 sort parameters available allow sort results groups , within groups.
sort -
how sort groups relative each other. example, sort=popularity desc cause groups sorted according highest popularity doc in each group. defaults "score desc".
note highest popularity, sort depend on max or latest result single document entire group.
group.sort -
how sort documents within single group. defaults same value sort parameter.
Comments
Post a Comment