public abstract class AbstractSolrConnector extends java.lang.Object implements SolrConnector
SolrConnector.LoadTimeURL
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CATCHALL_DTERM |
static java.lang.String |
CATCHALL_QUERY |
static java.lang.String |
CATCHALL_TERM |
static SolrQuery |
catchallQuery |
static SolrQuery |
catchSuccessQuery |
protected static int |
pagesize_docs |
protected static int |
pagesize_ids |
static SolrDocument |
POISON_DOCUMENT |
static java.lang.String |
POISON_ID |
protected static java.util.Set<java.lang.String> |
SOLR_ID_and_LOAD_DATE_FIELDS |
protected static java.util.Set<java.lang.String> |
SOLR_ID_FIELDS |
Constructor and Description |
---|
AbstractSolrConnector() |
Modifier and Type | Method and Description |
---|---|
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.
|
private java.util.concurrent.BlockingQueue<SolrDocument> |
concurrentDocumentsByQueriesNoPrefetch(java.util.List<java.lang.String> querystrings,
java.lang.String sort,
int offset,
int maxcount,
long maxtime,
int buffersize,
int concurrency,
java.lang.String... fields) |
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.
|
protected static java.lang.String[] |
ensureEssentialFieldsIncluded(java.lang.String[] fields)
check if fields contain id and load_date_dt date
|
long |
getCountByQuery(java.lang.String querystring)
get the number of results when this query is done.
|
SolrDocument |
getDocumentById(java.lang.String id,
java.lang.String... fields)
get a document from solr by given key for the id-field
|
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
|
protected static SolrConnector.LoadTimeURL |
getLoadTimeURL(java.lang.Object doc) |
SolrConnector.LoadTimeURL |
getLoadTimeURL(java.lang.String id)
check if a given document, identified by url hash as document id exists
|
static SolrQuery |
getSolrQuery(java.lang.String querystring,
java.lang.String sort,
int offset,
int count,
java.lang.String... fields) |
java.util.Iterator<java.lang.String> |
iterator() |
private SolrInputDocument |
partialUpdatePatch(SolrInputDocument docIn) |
void |
update(java.util.Collection<SolrInputDocument> solrdoc)
Update a collection of solr input documents.
|
void |
update(SolrInputDocument solrdoc)
Update a solr document.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
add, add, bufferSize, clear, clearCaches, close, commit, deleteById, deleteByIds, deleteByQuery, getDocumentListByParams, getResponseByParams, getSegmentCount, getSize, isClosed, optimize
protected static java.util.Set<java.lang.String> SOLR_ID_FIELDS
protected static java.util.Set<java.lang.String> SOLR_ID_and_LOAD_DATE_FIELDS
public static final SolrDocument POISON_DOCUMENT
public static final java.lang.String POISON_ID
public static final java.lang.String CATCHALL_TERM
public static final java.lang.String CATCHALL_DTERM
public static final java.lang.String CATCHALL_QUERY
public static final SolrQuery catchallQuery
public static final SolrQuery catchSuccessQuery
protected static final int pagesize_docs
protected static final int pagesize_ids
protected static SolrConnector.LoadTimeURL getLoadTimeURL(java.lang.Object doc)
protected static java.lang.String[] ensureEssentialFieldsIncluded(java.lang.String[] fields)
fields
- public 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)
concurrentDocumentsByQuery
in interface SolrConnector
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 fieldspublic 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)
concurrentDocumentsByQueries
in interface SolrConnector
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 fieldsprivate java.util.concurrent.BlockingQueue<SolrDocument> concurrentDocumentsByQueriesNoPrefetch(java.util.List<java.lang.String> querystrings, java.lang.String sort, int offset, int maxcount, long maxtime, int buffersize, int concurrency, java.lang.String... fields)
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)
concurrentIDsByQuery
in interface SolrConnector
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 feedpublic 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)
concurrentIDsByQueries
in interface SolrConnector
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 feedpublic java.util.Iterator<java.lang.String> iterator()
iterator
in interface java.lang.Iterable<java.lang.String>
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
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 static SolrQuery getSolrQuery(java.lang.String querystring, java.lang.String sort, int offset, int count, java.lang.String... fields)
public SolrConnector.LoadTimeURL getLoadTimeURL(java.lang.String id) throws java.io.IOException
getLoadTimeURL
in interface SolrConnector
id
- the url hash and document idjava.io.IOException
public long getCountByQuery(java.lang.String querystring) throws java.io.IOException
getCountByQuery
in interface SolrConnector
querystring
- 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
getFacets
in interface SolrConnector
query
- a query which is performed to get the facetsfields
- the field names which are selected as facetmaxresults
- the maximum size of the resulting mapsjava.io.IOException
public SolrDocument getDocumentById(java.lang.String id, java.lang.String... fields) throws java.io.IOException
SolrConnector
getDocumentById
in interface SolrConnector
fields
- list of fieldsjava.io.IOException
public void update(SolrInputDocument solrdoc) throws java.io.IOException, SolrException
update
in interface SolrConnector
solrdoc
- java.io.IOException
SolrException
public void update(java.util.Collection<SolrInputDocument> solrdoc) throws java.io.IOException, SolrException
update
in interface SolrConnector
solrdocs
- java.io.IOException
SolrException
private SolrInputDocument partialUpdatePatch(SolrInputDocument docIn)