Customize solr 4.10.3 search results

I have found type of document in solr database. Out of those 4, one is general document, second news, third books and fourth poetry. Now I want to query solr so that it should return 10 results. out of those 7 result should be from general documents, 1 from news, 1 from books and 1 from poetry. I am using solr in cloud mode.

Is it possible. if yes then how if not then why ? Basically, I want to get all these in one query.

Answers


You can use result grouping. Based on this documentation your request should be

http://localhost:8983/solr/techproducts/select?wt=json&indent=true&
                 q=you_query_string&group=true&group.field=type&group.limit=7

After search you should take seven items from group with general type, and by one item from others groups.


Need Your Help

Python Curses - module 'curses' has no attribute 'LINES'

python python-2.7 python-curses

I am looking at some source-code from a book and noticed that some of the code does not seem to be in the current Python2.7 API. The module curses is, according to this code, supposed to have a con...