setFrom for Facet Search


(Eugene Strokin) #1

Hello,
I have a simple ordered facet search, and it works fine. The result is
ordered by counts. I can set size of the result, but if I want to get a
next chunk of the counts, how could I get it?
Here is my code:

SearchResponse response = clientProvider.getClient()

.prepareSearch(clientProvider.getIndexName())

    .addFacet(

    FacetBuilders.termsFacet("myStat")

    .field("myField")

    .order(ComparatorType.COUNT)

    .size(30)

    .facetFilter(FilterBuilders.rangeFilter("sequence")

.from(Utils.nextSequence()-10006060*24)))

    .setTypes("myType")

    .execute()

    .actionGet();

So, I need something like setFrom() which we have for queries, but I need
it for facet search, and it doesn't look like we have it.

Could you please help me out here?

Thank you,


(Igor Motov) #2

I think all you can do at this moment is just retrieve 60 facets and ignore
first 30.

On Monday, May 14, 2012 8:47:19 PM UTC-4, Eugene Strokin wrote:

Hello,
I have a simple ordered facet search, and it works fine. The result is
ordered by counts. I can set size of the result, but if I want to get a
next chunk of the counts, how could I get it?
Here is my code:

SearchResponse response = clientProvider.getClient()

.prepareSearch(clientProvider.getIndexName())

    .addFacet(

    FacetBuilders.termsFacet("myStat")

    .field("myField")

    .order(ComparatorType.COUNT)

    .size(30)

    .facetFilter(FilterBuilders.rangeFilter("sequence")

.from(Utils.nextSequence()-10006060*24)))

    .setTypes("myType")

    .execute()

    .actionGet();

So, I need something like setFrom() which we have for queries, but I need
it for facet search, and it doesn't look like we have it.

Could you please help me out here?

Thank you,


(system) #3