public interface SolrConnector
extends java.lang.Iterable<java.lang.String>
Modifier and Type | Interface and Description |
---|---|
static class |
SolrConnector.LoadTimeURL |
Modifier and Type | Method and Description |
---|---|
void |
add(java.util.Collection<SolrInputDocument> solrdoc)
add a collection of solr input documents
|
void |
add(SolrInputDocument solrdoc)
add a solr input document
|
int |
bufferSize()
get the size of a write buffer (if any) of pending write requests
|
void |
clear()
delete everything in the solr index
|
void |
clearCaches()
clear all caches: inside solr and ouside solr within the implementations of this interface
|
void |
close()
close the server connection
|
void |
commit(boolean softCommit)
force a commit
|
java.util.concurrent.BlockingQueue<SolrDocument> |
concurrentDocumentsByQueries(java.util.List<java.lang.String> querystrings,
java.lang.String sort,
int offset,
int maxcount,
long maxtime,
int buffersize,
int concurrency,
boolean prefetchIDs,
java.lang.String... fields)
Get results from solr queries as a stream of documents.
|
java.util.concurrent.BlockingQueue<SolrDocument> |
concurrentDocumentsByQuery(java.lang.String querystring,
java.lang.String sort,
int offset,
int maxcount,
long maxtime,
int buffersize,
int concurrency,
boolean prefetchIDs,
java.lang.String... fields)
Get results from a solr query as a stream of documents.
|
java.util.concurrent.BlockingQueue<java.lang.String> |
concurrentIDsByQueries(java.util.List<java.lang.String> querystrings,
java.lang.String sort,
int offset,
int maxcount,
long maxtime,
int buffersize,
int concurrency)
get a document id result stream from a set of solr queries.
|
java.util.concurrent.BlockingQueue<java.lang.String> |
concurrentIDsByQuery(java.lang.String querystring,
java.lang.String sort,
int offset,
int maxcount,
long maxtime,
int buffersize,
int concurrency)
get a document id result stream from a solr query.
|
void |
deleteById(java.lang.String id)
delete an entry from solr using the url hash as document id
|
void |
deleteByIds(java.util.Collection<java.lang.String> ids)
delete a set of entries from solr; entries are identified by their url hash
|
void |
deleteByQuery(java.lang.String querystring)
delete entries from solr according the given solr query string
|
long |
getCountByQuery(java.lang.String querystring)
get the number of results when this query is done.
|
SolrDocument |
getDocumentById(java.lang.String key,
java.lang.String... fields)
get a document from solr by given key for the id-field
|
SolrDocumentList |
getDocumentListByParams(ModifiableSolrParams params)
get the solr document list from a query response
This differs from getResponseByParams in such a way that it does only create the fields of the response but
never search snippets and there are also no facets generated.
|
SolrDocumentList |
getDocumentListByQuery(java.lang.String querystring,
java.lang.String sort,
int offset,
int count,
java.lang.String... fields)
get a query result from solr
to get all results set the query String to "*:*"
|
java.util.LinkedHashMap<java.lang.String,ReversibleScoreMap<java.lang.String>> |
getFacets(java.lang.String query,
int maxresults,
java.lang.String... fields)
get facets of the index: a list of lists with values that are most common in a specific field
|
SolrConnector.LoadTimeURL |
getLoadTimeURL(java.lang.String id)
check if a given document, identified by url hash as document id exists
|
QueryResponse |
getResponseByParams(ModifiableSolrParams query)
get a "full" query response from solr.
|
int |
getSegmentCount()
ask the solr subsystem about it's segment number
|
long |
getSize()
get the size of the index
|
boolean |
isClosed()
test if the connector is already closed
|
void |
optimize(int maxSegments)
force an explicit merge of segments
|
void |
update(java.util.Collection<SolrInputDocument> solrdoc)
Update a collection of solr input documents.
|
void |
update(SolrInputDocument solrdoc)
Update a solr document.
|
void clearCaches()
int bufferSize()
long getSize()
void commit(boolean softCommit)
void optimize(int maxSegments)
maxSegments
- the maximum number of segments. Set to 1 for maximum optimizationint getSegmentCount()
boolean isClosed()
void close()
void clear() throws java.io.IOException
java.io.IOException
void deleteById(java.lang.String id) throws java.io.IOException
id
- the url hash of the entryjava.io.IOException
void deleteByIds(java.util.Collection<java.lang.String> ids) throws java.io.IOException
ids
- a list of url hashesjava.io.IOException
void deleteByQuery(java.lang.String querystring) throws java.io.IOException
querystring
- java.io.IOException
SolrConnector.LoadTimeURL getLoadTimeURL(java.lang.String id) throws java.io.IOException
id
- the url hash and document idjava.io.IOException
void add(SolrInputDocument solrdoc) throws java.io.IOException, SolrException
solrdoc
- java.io.IOException
SolrException
void update(SolrInputDocument solrdoc) throws java.io.IOException, SolrException
solrdoc
- java.io.IOException
SolrException
void add(java.util.Collection<SolrInputDocument> solrdoc) throws java.io.IOException, SolrException
solrdocs
- java.io.IOException
SolrException
void update(java.util.Collection<SolrInputDocument> solrdoc) throws java.io.IOException, SolrException
solrdocs
- java.io.IOException
SolrException
SolrDocument getDocumentById(java.lang.String key, java.lang.String... fields) throws java.io.IOException
key
- fields
- list of fieldsjava.io.IOException
QueryResponse getResponseByParams(ModifiableSolrParams query) throws java.io.IOException
query
- java.io.IOException
SolrDocumentList getDocumentListByParams(ModifiableSolrParams params) throws java.io.IOException
params
- java.io.IOException
SolrException
SolrDocumentList getDocumentListByQuery(java.lang.String querystring, java.lang.String sort, int offset, int count, java.lang.String... fields) throws java.io.IOException
querystring
- the solr query stringsort
- the solr sort string, may be null to be not usedoffset
- the first result offsetcount
- number of wanted resultsfields
- list of fieldsjava.io.IOException
long getCountByQuery(java.lang.String querystring) throws java.io.IOException
querystring
- java.io.IOException
java.util.LinkedHashMap<java.lang.String,ReversibleScoreMap<java.lang.String>> getFacets(java.lang.String query, int maxresults, java.lang.String... fields) throws java.io.IOException
query
- a query which is performed to get the facetsmaxresults
- the maximum size of the resulting mapsfields
- the field names which are selected as facetjava.io.IOException
java.util.concurrent.BlockingQueue<SolrDocument> concurrentDocumentsByQuery(java.lang.String querystring, java.lang.String sort, int offset, int maxcount, long maxtime, int buffersize, int concurrency, boolean prefetchIDs, java.lang.String... fields)
querystring
- the solr query stringsort
- the solr sort string, may be null to be not usedoffset
- first result offsetmaxcount
- the maximum number of resultsmaxtime
- the maximum time in millisecondsbuffersize
- the size of an ArrayBlockingQueue; if <= 0 then a LinkedBlockingQueue is usedconcurrency
- is the number of AbstractSolrConnector.POISON_DOCUMENT entries to add at the end of the feedprefetchIDs
- if true, then first all IDs are fetched and then all documents are queries by the ID. If false then documents are retrieved directlyfields
- list of fieldsjava.util.concurrent.BlockingQueue<SolrDocument> concurrentDocumentsByQueries(java.util.List<java.lang.String> querystrings, java.lang.String sort, int offset, int maxcount, long maxtime, int buffersize, int concurrency, boolean prefetchIDs, java.lang.String... fields)
querystrings
- the list of solr query stringssort
- the solr sort string, may be null to be not usedoffset
- first result offsetmaxcount
- the maximum number of resultsmaxtime
- the maximum time in millisecondsbuffersize
- the size of an ArrayBlockingQueue; if <= 0 then a LinkedBlockingQueue is usedconcurrency
- is the number of AbstractSolrConnector.POISON_DOCUMENT entries to add at the end of the feedprefetchIDs
- if true, then first all IDs are fetched and then all documents are queries by the ID. If false then documents are retrieved directlyfields
- list of fieldsjava.util.concurrent.BlockingQueue<java.lang.String> concurrentIDsByQuery(java.lang.String querystring, java.lang.String sort, int offset, int maxcount, long maxtime, int buffersize, int concurrency)
querystring
- sort
- the solr sort string, may be null to be not usedoffset
- maxcount
- buffersize
- the size of an ArrayBlockingQueue; if <= 0 then a LinkedBlockingQueue is usedconcurrency
- is the number of AbstractSolrConnector.POISON_ID entries to add at the end of the feedjava.util.concurrent.BlockingQueue<java.lang.String> concurrentIDsByQueries(java.util.List<java.lang.String> querystrings, java.lang.String sort, int offset, int maxcount, long maxtime, int buffersize, int concurrency)
querystring
- a list of query stringssort
- the solr sort string, may be null to be not usedoffset
- common offset of all queriesmaxcount
- maximum count for each querybuffersize
- the size of an ArrayBlockingQueue; if <= 0 then a LinkedBlockingQueue is usedconcurrency
- is the number of AbstractSolrConnector.POISON_ID entries to add at the end of the feed