I'm using facets to get partition search results into ranges. The search returns a list item and each item has a score. In the list the items are ordered by score from high to low. Some items may also have equal score.
I use facets to get the top 10, then the next 100.
My idea is to use the range facet. The problem is that I never know the maxim scor. Each time it is different. But since search results are returned in order by score I can probably use the range facet without caring ab the range:
//top 10 best matches with score: [0-infinity) but since they items are ordered I think it will return top 10 items
FacetBuilders.rangeFacet("top10Matches").field("score").addUnboundedTo(0).size(10)
This is simple enough. Now I'm not sure how to get the next chunk which is wherever the previous facet left off and have a size of 100. I could probably check the score of the last item in the results the first facet returned and use that as my top range, but if there are items with that exact score they will be skipped.
Is there a way to do what I need with facets?
There is a setFrom(Int)
method that I can use. No facets needed.
val queryString = client.get.prepareSearch()
.setQuery(QueryBuilders.matchQuery(NODE_PATH_TO_SEARCH, query))
.setFrom(currentPageNumber*MAX_DISPLAYABLE_RESULTS)
.setSize(MAX_DISPLAYABLE_RESULTS)
queryString.execute().actionGet()