public class MirrorSolrConnector extends AbstractSolrConnector implements SolrConnector
SolrConnector.LoadTimeURL
Modifier and Type | Field and Description |
---|---|
private SolrConnector |
solr0 |
private SolrConnector |
solr1 |
CATCHALL_DTERM, CATCHALL_QUERY, CATCHALL_TERM, catchallQuery, catchSuccessQuery, pagesize_docs, pagesize_ids, POISON_DOCUMENT, POISON_ID, SOLR_ID_and_LOAD_DATE_FIELDS, SOLR_ID_FIELDS
Constructor and Description |
---|
MirrorSolrConnector() |
MirrorSolrConnector(SolrConnector solr0,
SolrConnector solr1) |
Modifier and Type | Method and Description |
---|---|
void |
add(java.util.Collection<SolrInputDocument> solrdocs)
add a solr input document
|
void |
add(SolrInputDocument solrdoc)
add a Solr 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<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 |
connect0(SolrConnector c) |
void |
connect1(SolrConnector c) |
void |
deleteById(java.lang.String id)
delete an entry from solr
|
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
|
void |
disconnect0() |
void |
disconnect1() |
boolean |
equals(java.lang.Object o) |
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 query)
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
|
SolrConnector |
getSolr0() |
SolrConnector |
getSolr1() |
int |
hashCode() |
boolean |
isClosed()
test if the connector is already closed
|
boolean |
isConnected0() |
boolean |
isConnected1() |
void |
optimize(int maxSegments)
force an explicit merge of segments
|
concurrentDocumentsByQueries, concurrentDocumentsByQuery, concurrentIDsByQueries, ensureEssentialFieldsIncluded, getLoadTimeURL, getSolrQuery, iterator, update, update
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
concurrentDocumentsByQueries, concurrentDocumentsByQuery, concurrentIDsByQueries, update, update
private SolrConnector solr0
private SolrConnector solr1
public MirrorSolrConnector()
public MirrorSolrConnector(SolrConnector solr0, SolrConnector solr1)
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int bufferSize()
SolrConnector
bufferSize
in interface SolrConnector
public void clearCaches()
SolrConnector
clearCaches
in interface SolrConnector
public boolean isConnected0()
public void connect0(SolrConnector c)
public SolrConnector getSolr0()
public void disconnect0()
public boolean isConnected1()
public void connect1(SolrConnector c)
public SolrConnector getSolr1()
public void disconnect1()
public void commit(boolean softCommit)
SolrConnector
commit
in interface SolrConnector
public void optimize(int maxSegments)
SolrConnector
optimize
in interface SolrConnector
maxSegments
- the maximum number of segments. Set to 1 for maximum optimizationpublic int getSegmentCount()
SolrConnector
getSegmentCount
in interface SolrConnector
public boolean isClosed()
SolrConnector
isClosed
in interface SolrConnector
public void close()
SolrConnector
close
in interface SolrConnector
public void clear() throws java.io.IOException
clear
in interface SolrConnector
java.io.IOException
public void deleteById(java.lang.String id) throws java.io.IOException
deleteById
in interface SolrConnector
id
- the url hash of the entryjava.io.IOException
public void deleteByIds(java.util.Collection<java.lang.String> ids) throws java.io.IOException
deleteByIds
in interface SolrConnector
ids
- a list of url hashesjava.io.IOException
public void deleteByQuery(java.lang.String querystring) throws java.io.IOException
SolrConnector
deleteByQuery
in interface SolrConnector
java.io.IOException
public SolrDocument getDocumentById(java.lang.String key, java.lang.String... fields) throws java.io.IOException
SolrConnector
getDocumentById
in interface SolrConnector
getDocumentById
in class AbstractSolrConnector
fields
- list of fieldsjava.io.IOException
public void add(SolrInputDocument solrdoc) throws java.io.IOException
add
in interface SolrConnector
solrdoc
- java.io.IOException
public void add(java.util.Collection<SolrInputDocument> solrdocs) throws java.io.IOException, SolrException
SolrConnector
add
in interface SolrConnector
java.io.IOException
SolrException
public SolrDocumentList getDocumentListByQuery(java.lang.String querystring, java.lang.String sort, int offset, int count, java.lang.String... fields) throws java.io.IOException
getDocumentListByQuery
in interface SolrConnector
getDocumentListByQuery
in class AbstractSolrConnector
querystring
- sort
- the solr sort string, may be null to be not usedoffset
- the first result offsetcount
- number of wanted resultsfields
- list of fieldsjava.io.IOException
public QueryResponse getResponseByParams(ModifiableSolrParams query) throws java.io.IOException, SolrException
SolrConnector
getResponseByParams
in interface SolrConnector
java.io.IOException
SolrException
public SolrDocumentList getDocumentListByParams(ModifiableSolrParams query) throws java.io.IOException, SolrException
SolrConnector
getDocumentListByParams
in interface SolrConnector
java.io.IOException
SolrException
public long getCountByQuery(java.lang.String querystring) throws java.io.IOException
AbstractSolrConnector
getCountByQuery
in interface SolrConnector
getCountByQuery
in class AbstractSolrConnector
java.io.IOException
public 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
AbstractSolrConnector
getFacets
in interface SolrConnector
getFacets
in class AbstractSolrConnector
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
public long getSize()
SolrConnector
getSize
in interface SolrConnector
public SolrConnector.LoadTimeURL getLoadTimeURL(java.lang.String id) throws java.io.IOException
AbstractSolrConnector
getLoadTimeURL
in interface SolrConnector
getLoadTimeURL
in class AbstractSolrConnector
id
- the url hash and document idjava.io.IOException
public 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)
AbstractSolrConnector
concurrentIDsByQuery
in interface SolrConnector
concurrentIDsByQuery
in class AbstractSolrConnector
sort
- the solr sort string, may be null to be not usedbuffersize
- 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