I have a collection of documents that belongs to several authors:
[ { id: 1, author_id: 'mark', content: [...] }, { id: 2, author_id: 'pierre', content: [...] }, { id: 3, author_id: 'pierre', content: [...] }, { id: 4, author_id: 'mark', content: [...] }, { id: 5, author_id: 'william', content: [...] }, ... ]
I would like to get and paginate various collections of the best matching document based on author id:
[ { id: 1, author_id: 'mark', content: [...], _score: 100 }, { id: 3, author_id: 'pierre', content: [...], _score: 90 }, { id: 5, author_id: 'william', content: [...], _score: 80 }, ... ]
Here is what I am doing now (pseudo-code):
unique_docs = res.results.to_a.uniq{ |doc| doc.author_id }
The problem of proper pagination: how to choose 20 "excellent" documents?
Some people specify term facets , but I'm not actually tag clouds:
Thanks,
Gallery