public class StandardSearchEngine extends Object implements SearchEngine
Modifier and Type | Field and Description |
---|---|
protected DocumentDAO |
documentDao |
protected static org.slf4j.Logger |
log |
protected org.apache.solr.client.solrj.embedded.EmbeddedSolrServer |
server |
Modifier | Constructor and Description |
---|---|
protected |
StandardSearchEngine() |
Modifier and Type | Method and Description |
---|---|
void |
addHit(Document document,
InputStream content)
Adds a new hit to the index
|
void |
addHit(Document document,
String content)
Adds a new Hit into the index
|
String |
check()
Launch the check on the Index
|
void |
close()
Close all indexing operations, shuts down the engine.
|
void |
deleteHit(long id)
Deletes an hit in the index of the search engine.
|
void |
deleteHits(Collection<Long> ids)
Removed all passed hits from the index
|
void |
dropIndexes()
Drops the fulltext index
|
long |
getCount()
Returns the number of indexed documents in all indexes.
|
Hit |
getHit(long id) |
Object |
getServer()
Service method to get access from the internal core
|
void |
init()
To be called on the context startup, this method creates all indexes and
unlock the existing ones
|
boolean |
isLocked()
Check if at least one index is locked
|
void |
optimize()
Launch the index optimization and triggers the build of spellcheck
dictionary
|
protected org.apache.solr.client.solrj.SolrQuery |
prepareSearchQuery(String expression,
String[] filters,
String expressionLanguage,
Integer rows)
Prepares the query for a search.
|
Hits |
search(String expression,
String[] filters,
String expressionLanguage,
Integer rows)
Search for hits.
|
void |
setConfig(ContextProperties config) |
void |
setDocumentDao(DocumentDAO documentDao) |
void |
unlock()
This method can unlock a locked index.
|
protected static org.slf4j.Logger log
protected DocumentDAO documentDao
protected org.apache.solr.client.solrj.embedded.EmbeddedSolrServer server
public void setConfig(ContextProperties config)
public void setDocumentDao(DocumentDAO documentDao)
public void addHit(Document document, String content) throws Exception
SearchEngine
addHit
in interface SearchEngine
Exception
public void addHit(Document document, InputStream content) throws Exception
SearchEngine
addHit
in interface SearchEngine
document
- The document that we want to addcontent
- Stream of the document's fileException
public void optimize()
SearchEngine
optimize
in interface SearchEngine
public String check()
SearchEngine
check
in interface SearchEngine
public void deleteHit(long id)
SearchEngine
deleteHit
in interface SearchEngine
id
- - id of the hitpublic void deleteHits(Collection<Long> ids)
SearchEngine
deleteHits
in interface SearchEngine
ids
- Collection of hit identifierspublic Hit getHit(long id)
getHit
in interface SearchEngine
public Hits search(String expression, String[] filters, String expressionLanguage, Integer rows)
SearchEngine
search
in interface SearchEngine
protected org.apache.solr.client.solrj.SolrQuery prepareSearchQuery(String expression, String[] filters, String expressionLanguage, Integer rows)
public void close()
SearchEngine
close
in interface SearchEngine
public void unlock()
SearchEngine
unlock
in interface SearchEngine
public boolean isLocked()
SearchEngine
isLocked
in interface SearchEngine
public long getCount()
SearchEngine
getCount
in interface SearchEngine
SearchEngine.getCount()
public void dropIndexes()
SearchEngine
dropIndexes
in interface SearchEngine
SearchEngine.dropIndexes()
public void init()
SearchEngine
init
in interface SearchEngine
SearchEngine.init()
public Object getServer()
SearchEngine
getServer
in interface SearchEngine
Copyright © 2008-2014 Logical Objects. All Rights Reserved.