001/*
002 * Copyright 2014 Global Biodiversity Information Facility (GBIF)
003 * Licensed under the Apache License, Version 2.0 (the "License");
004 * you may not use this file except in compliance with the License.
005 * You may obtain a copy of the License at
006 * http://www.apache.org/licenses/LICENSE-2.0
007 * Unless required by applicable law or agreed to in writing, software
008 * distributed under the License is distributed on an "AS IS" BASIS,
009 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
010 * See the License for the specific language governing permissions and
011 * limitations under the License.
012 */
013package org.gbif.api.service.common;
014
015import org.gbif.api.model.common.search.SearchParameter;
016import org.gbif.api.model.common.search.SearchRequest;
017
018import java.util.List;
019
020
021/**
022 * Generic search interface for a suggest/autocomplete service.
023 * This marker interface should be extended by other interfaces that support this functionality.
024 *
025 * @param <T> the type of returned results
026 * @param <P> the supported search parameter enumeration
027 * @param <R> the supported search request type. For faceted searches this needs to extend
028 *        {@link org.gbif.api.model.common.search.FacetedSearchRequest}
029 */
030public interface SuggestService<T, P extends Enum<?> & SearchParameter, R extends SearchRequest<P>> {
031
032  /**
033   * Issues a SearchRequest for a suggest and retrieves the list of matches.
034   * The actual result information will contain a list elements of type T.
035   *
036   * @param suggestRequest the input object to be used for performing the operation.
037   */
038  List<T> suggest(R suggestRequest);
039
040}