All Downloads are FREE. Search and download functionalities are using the official Maven repository.

se.l4.silo.search.facet.CategoryFacetQuery Maven / Gradle / Ivy

There is a newer version: 0.2.3
Show newest version
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)));
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy