sortingsolrsolr4solr5

Solr: different sort result between 2 core


I have this 2 core of solr, one called catalogs and the others special_page. It contains data from the same db, the difference is catalogs contain more field than the others (catalogs is in solr 5 and special in solr 4, yes differ solr version).

Problem is, when I have to sort this particular data, eg. special_page which id is 1 then sort by product_scroring desc. This 2 core having different order of results.

catalogs schema for product scoring : <field name="product_scoring" type="text_general" indexed="true" stored="true" multiValued="false" default=""/>

special_page schema for product_scoring : <field name="product_scoring" type="text_general" indexed="true" stored="true"/>

Can anyone suggest me what would make this 2 core produce same order of result? Thanks

query result sort from catalogs

query result sort from special_page


Solution

  • If you're actually indexing float values, don't index them as text. Text will split the content into separate tokens based on multiple separators, such as "." and whitespace. Depending on how exact you need the values to be, using a double or float is a possibility (but remember, doubles and floats are not exact).

    Secondly, since the value in the fields are identical, the ordering between documents are undefined (.. or it will default to the order they've been added in, but that may change and may not be the same across both cores). Use a secondary, stable field (such as the name, id, date added, etc.) to get identical sorting of the same data across cores (this is also why a cursorMark requires sorting by a unique key when used).