YaCy can now use the solr index to compute text snippets. This makes search result preparation MUCH faster because no document fetching and parsing is necessary any more.
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7943 6c8d7289-2bf4-0310-a012-ef5d649a1542pull/1/head
parent
0819e1d397
commit
85a5487d6d
@ -0,0 +1,99 @@
|
|||||||
|
/**
|
||||||
|
* SolrConnector
|
||||||
|
* Copyright 2011 by Michael Peter Christen
|
||||||
|
* First released 13.09.2011 at http://yacy.net
|
||||||
|
*
|
||||||
|
* $LastChangedDate: 2011-04-14 22:05:04 +0200 (Do, 14 Apr 2011) $
|
||||||
|
* $LastChangedRevision: 7654 $
|
||||||
|
* $LastChangedBy: orbiter $
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this program in the file lgpl21.txt
|
||||||
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.yacy.cora.services.federated.solr;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.yacy.cora.protocol.ResponseHeader;
|
||||||
|
import net.yacy.document.Document;
|
||||||
|
import net.yacy.kelondro.data.meta.DigestURI;
|
||||||
|
|
||||||
|
import org.apache.solr.common.SolrDocumentList;
|
||||||
|
|
||||||
|
public interface SolrConnector {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* with a scheme the fields of a SolrDocument can be translated to actual data values
|
||||||
|
* @return the solr scheme that can translate the SolrDocument
|
||||||
|
*/
|
||||||
|
public SolrScheme getScheme();
|
||||||
|
|
||||||
|
public void close();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* delete everything in the solr index
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public void clear() throws IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* delete an entry from solr
|
||||||
|
* @param id the url hash of the entry
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public void delete(final String id) throws IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* delete a set of entries from solr; entries are identified by their url hash
|
||||||
|
* @param ids a list of url hashes
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public void delete(final List<String> ids) throws IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add a YaCy document. This calls the scheme processor to add the document as solr document
|
||||||
|
* @param id the url hash of the entry
|
||||||
|
* @param header the http response header
|
||||||
|
* @param doc the YaCy document
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public void add(final String id, final ResponseHeader header, final Document doc) throws IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* register an entry as error document
|
||||||
|
* @param digestURI
|
||||||
|
* @param failReason
|
||||||
|
* @param httpstatus
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public void err(final DigestURI digestURI, final String failReason, final int httpstatus) throws IOException;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get a query result from solr
|
||||||
|
* to get all results set the query String to "*:*"
|
||||||
|
* @param querystring
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public SolrDocumentList get(final String querystring, final int offset, final int count) throws IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the size of the index
|
||||||
|
* @return number of results if solr is queries with a catch-all pattern
|
||||||
|
*/
|
||||||
|
public long getSize();
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in new issue