Hi All > > I have an index which contains a Catalog of Products and Categories, with > Solr 4.0 from trunk > > Data is organized like this: > > Category: Books > > Sub Category: Programming > > Products: > > Product # 1, Price: Regular Sort Order:1 > Product # 2, Price: Markdown, Sort Order:2 > Product # 3 Price: Regular, Sort Order:3 > Product # 4 Price: Regular, Sort Order:4 > .... > ..... > ... > Product # 100 Price: Regular, Sort Order:100 > > Sub Category: Fiction > > Products: > > Product # 1, Price: Markdown, Sort Order:1 > Product # 2, Price: Regular, Sort Order:2 > Product # 3 Price: Regular, Sort Order:3 > Product # 4 Price: Markdown, Sort Order:4 > .... > ..... > ... > Product # 70 Price: Regular, Sort Order:70 > > > I want to query Solr and sort these products within each of the > sub-category in a such a way that products which are on markdown, are at > the bottom of the documents list and other products > which are on regular price, are sorted as per their sort order in their > sub-category. > > Expected Results are > > Category: Books > > Sub Category: Programming > > Products: > > Product # 1, Price: Regular Sort Order:1 > Product # 2, Price: Markdown, Sort Order:101 > Product # 3 Price: Regular, Sort Order:3 > Product # 4 Price: Regular, Sort Order:4 > .... > ..... > ... > Product # 100 Price: Regular, Sort Order:100 > > Sub Category: Fiction > > Products: > > Product # 1, Price: Markdown, Sort Order:71 > Product # 2, Price: Regular, Sort Order:2 > Product # 3 Price: Regular, Sort Order:3 > Product # 4 Price: Markdown, Sort Order:71 > .... > ..... > ... > Product # 70 Price: Regular, Sort Order:70 > > > My query is like this: > > q=*:*&fq=category:Books > > What are the options to implement custom sorting and how do I do it? > > > - Define a Custom Function query? > - Define a Custom Comparator? Or, > - Define a Custom Collector? > > > Please let me know the best way to go about it and any pointers to > customize Solr 4. >
Thanks Saroj