简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM