/**
 * Copyright 2008-2009 DRIVER PROJECT (ICM UW)
 * Original author: Marek Horst
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package eu.dnetlib.data.index.ws.yadda;

import java.util.Collection;

import eu.dnetlib.data.index.ws.commons.event.IIndexListener;

import pl.edu.icm.yadda.service.search.SearchException;
import pl.edu.icm.yadda.service.search.searching.SearchResults;
import pl.edu.icm.yadda.service.search.searching.stats.QueryStats;
import pl.edu.icm.yadda.service.search.searching.stats.QueryStatsRequest;

/**
 * Facade to SearchModule.
 * @author wojtek
 */
public interface SearchModuleFacade extends IIndexListener {

	/** Lists names of all configured indexes. */
	public Collection<String> listIndexNames();

	/**
	 * Performs search in given set of indices.
	 * If no indexes are specified, searches all single indexes matching
	 * <code>query.getMdFormatId()</code> and <code>query.getLayoutId()</code>
	 */
	public SearchResults search(DriverQuery query, String... indexNames) throws SearchException;

	/** 
	 * Returns statistics for given query and statistics request. Search
	 * is performed in set of indexes defined by <code>indexNames</code>.
	 * If <code>indexNames</code> is empty array or null, search is performed
	 * in all indexes matching <code>query.getMdFormatId()</code>
	 * and <code>query.getLayoutId()</code>. Query's
	 * <code>first</code> and <code>size</code> attributes are ignored.
	 */
	public QueryStats getQueryStats(QueryStatsRequest request, DriverQuery query, String[] indexNames) throws SearchException;
	
	/**
	 * Removes filter (for BBQ query) from cache.
	 * @param filterName
	 */
	public void removeFilter(String filterName) throws SearchException;
	
}
