2

I want to search 3 different indices at once, breaking out their results into 3 separate sections.

Above these 3 sections though, I want to display a 4th section with a single result row, and this section will be titled "Best Result".

It should take the best result of the 3 indices that most perfectly matches.

Does anyone know how I can achieve this? Thanks!

4

1 回答 1

3

By design, when the ranking of each index is properly set (both attributeToIndex, and customRanking settings filled), the Algolia engine returns the most relevant et popular results for each new search request. First the one without typos and with perfect matches, then the others...

Which mean that if you want to display all the top results on a single page, you only need to take the N first result of each index. Then it's just a matter of display. Like on the following websites, you can imagine to display those results into multiple columns:

Feel free to look at tips about the best way to display result hits in multiple columns using Algolia and Bootstrap 3

Beside that you can also consider passing the getRankingInfo=1 parameter with your search query, and filter the results displayed accordingly to the matching info returned for each hit within the _rankingInfo property.

firstMatchedWord: 2000
geoDistance: 0
geoPrecision: 1
nbExactWords: 2
nbTypos: 0
proximityDistance: 1
userScore: 9499
words: 2
于 2015-12-28T09:29:58.897 回答