#community-help

Limiting Search Results by Facet Value

TLDR Andrew asks Jason and Kishore Nallan how to limit search results by facet value. Kishore Nallan suggests using group_by function to achieve that, which Andrew accepts.

Powered by Struct AI

1

7
9mo
Solved
Join the chat
Jan 13, 2023 (9 months ago)
Andrew
Photo of md5-88d88db4789daa0e3abef8c3ca27772b
Andrew
07:59 AM
Hi Jason Kishore Nallan Is there any way to limit the number of items by a certain facet value? Our exact case is to return the top 10 newest articles, but with max 2 articles by any one author?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
08:06 AM
It's not possible to do that via faceting.
Andrew
Photo of md5-88d88db4789daa0e3abef8c3ca27772b
Andrew
08:06 AM
is there any other way to do this?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
08:07 AM
I was thinking of group by but that cannot really do the "top" operation. Can you please create a github issue for this feature?
08:10
Kishore Nallan
08:10 AM
Andrew Actually group_by can do this.
08:11
Kishore Nallan
08:11 AM
Sort the results by timestamp desc for top newest articles but group results by author with group limit of 2.
Andrew
Photo of md5-88d88db4789daa0e3abef8c3ca27772b
Andrew
09:16 AM
thats super Kishore Nallan thank you

1