java - How can I maintain the row mapping after sorting on facets? If I sort on 1 facet, other column values don't get sorted accordingly -
i new solr , trying write query contains facets supposed linked after sorting.
for instance, database contains id , name fields (along other attributes). have added 2 facetfields in code as
sq.setfacet(true); sq.setfacetmincount(1); sq.addfacetfield(id); sq.addfacetfield(name); i need sort on id along name. currently, when sort query, sorts id , name separately in ascending order. tried sorting on count , index both sorts fields separately.
my database table looks like:
id name 1002 spring 1001 winter 1003 summer results get:
block [1001(1),1002(1),1003(1)] block [spring,summer,winter] but see, mapping between fields in result lost though sort works individually. expect like:
block[1001:winter,1002:spring,1003:summer] this me fetch correct id respective name (and keep proper row mapping each entry in table).
is there way can maintain row mapping after sorting?
thank in advance!
every facet order it's independent of others, if store id , name in separated fields, can't assume both going in same row. count case if result number different each one. (so if have 3 summer, 2 winter , 1 spring, have same order in 2 facets).
in case made 1 of these 2 things, store id , name database, or actually, hashtable cached in app. other 1 index facet fields concatenated ex:winter|id (spring|1002) , spliting "|" once again in solr client.
Comments
Post a Comment