se.l4.silo.search.facet.CategoryFacetQuery Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of silo-search-api Show documentation
Show all versions of silo-search-api Show documentation
API for Lucene-based querying for Silo.
package se.l4.silo.search.facet;
import java.util.function.Function;
import se.l4.silo.search.FacetItem;
import se.l4.silo.search.FacetQueryBuilder;
public class CategoryFacetQuery
implements FacetQueryBuilder
{
private String id;
private Function configReceiver;
private int count;
public CategoryFacetQuery()
{
count = Integer.MAX_VALUE;
}
@Override
public void setReceiver(String id, Function configReceiver)
{
this.id = id;
this.configReceiver = configReceiver;
}
/**
* Limit the number of returned facets to the given count.
*
* @param count
* @return
*/
public CategoryFacetQuery max(int count)
{
this.count = count;
return this;
}
@Override
public Parent done()
{
return configReceiver.apply(new FacetItem(id, new SimpleFacetQuery(count)));
}
}