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