001/**
002 * Copyright (C) 2014  Universidade de Aveiro, DETI/IEETA, Bioinformatics Group - http://bioinformatics.ua.pt/
003 *
004 * This file is part of Dicoogle/dicoogle-sdk.
005 *
006 * Dicoogle/dicoogle-sdk is free software: you can redistribute it and/or modify
007 * it under the terms of the GNU General Public License as published by
008 * the Free Software Foundation, either version 3 of the License, or
009 * (at your option) any later version.
010 *
011 * Dicoogle/dicoogle-sdk is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014 * GNU General Public License for more details.
015 *
016 * You should have received a copy of the GNU General Public License
017 * along with Dicoogle.  If not, see <http://www.gnu.org/licenses/>.
018 */
019package pt.ua.dicoogle.sdk;
020
021import pt.ua.dicoogle.sdk.datastructs.SearchResult;
022
023/**
024 * Query Interface Plugin. Query plugins provide a means of handling queries and obtaining search results.
025 * They will usually rely on indices created by an indexer plugin.
026 *
027 * @author Luís A. Bastião Silva <bastiao@ua.pt>
028 * @author fmvalente
029 */
030public interface QueryInterface extends DicooglePlugin 
031{
032    /**
033     * Performs a search on the database.
034     * 
035     * The consumer of the results would either request an iterator or use a for-each loop. The underlying
036     * iterator implementation can be redefined to wait for more results at the caller.
037     *
038     * @param query a string describing the query. The underlying plugin is currently free to follow any
039     * query format, but only those based on Lucene with work with the search user interface.
040     * @param parameters A variable list of parameters of the query. The plugin can use them to establish
041     * their own API's, which may require more complex data structures (e.g. images).
042     * 
043     * @return the results of the query as a (possibly lazy) iterable
044     */
045    public Iterable<SearchResult> query(String query, Object ... parameters);
046}