|
Nuxeo Enterprise Platform 5.4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.nuxeo.runtime.model.DefaultComponent org.nuxeo.ecm.core.search.service.SearchServiceImpl
public class SearchServiceImpl
Nuxeo core search service implementation.
SearchService
,
Serialized FormField Summary | |
---|---|
static int |
DEFAULT_DOC_BATCH_SIZE
|
static int |
DEFAULT_MAX_POOL_SIZE
|
static ComponentName |
NAME
|
Constructor Summary | |
---|---|
SearchServiceImpl()
|
Method Summary | |
---|---|
void |
activate(ComponentContext context)
Activates the component. |
void |
clear()
Completely erases the indexes. |
void |
closeSession(java.lang.String sid)
Closes a search service session given its identifier. |
void |
deactivate(ComponentContext context)
Deactivates the component. |
void |
deleteAggregatedResources(java.lang.String key)
Deletes an index given an aggregated resources key. |
void |
deleteAtomicResource(java.lang.String key)
Deletes an atomic resource given its key. |
int |
getActiveIndexingTasks()
Returns the number of running indexing tasks. |
java.lang.String[] |
getAvailableBackendNames()
Returns the list of all backend names. |
BlobExtractor |
getBlobExtractorByName(java.lang.String name)
Returns a blob extractor given its name. |
static CoreSession |
getCoreSession(java.lang.String repoName)
|
java.lang.String |
getDefaultSearchEngineBakendName()
Returns the default backend. |
java.util.Set<java.lang.String> |
getDocumentTypeNamesExtending(java.lang.String docType)
Return the names of core document types extending the given one, which is included. |
java.util.Set<java.lang.String> |
getDocumentTypeNamesForFacet(java.util.Collection<java.lang.String> facets)
Returns the set of document types bearing one of given facets. |
java.util.Set<java.lang.String> |
getDocumentTypeNamesForFacet(java.lang.String facet)
Returns the set of document types bearing a given facet. |
FulltextFieldDescriptor |
getFullTextDescriptorByName(java.lang.String name)
Returns the full text descriptor given its name. |
IndexableResourceDataConf |
getIndexableDataConfByName(java.lang.String name)
Returns the indexing data conf by its name. |
IndexableResourceDataConf |
getIndexableDataConfFor(java.lang.String dataName)
Returns the indexing data conf for a given data name. |
IndexableDocType |
getIndexableDocTypeFor(java.lang.String docType)
Return the indexing information for a given nuxeo core doc type. |
java.util.Map<java.lang.String,IndexableDocType> |
getIndexableDocTypes()
Returns a map from doc type to indexable doc types. |
IndexableResourceConf |
getIndexableResourceConfByName(java.lang.String name,
boolean full)
Returns an indexable resource configuration given its name. |
IndexableResourceConf |
getIndexableResourceConfByPrefix(java.lang.String prefix,
boolean full)
Returns an indexable resource configuration given its prefix. |
java.util.Map<java.lang.String,IndexableResourceConf> |
getIndexableResourceConfs()
Returns all the indexable resource configurations registred. |
int |
getIndexingDocBatchSize()
Returns the document batch size. |
IndexingEventConf |
getIndexingEventConfByName(java.lang.String name)
Returns an indexing event configuration given its name. |
long |
getIndexingWaitingQueueSize()
Returns the number of indexing tasks waiting for a slot in the ThreadPool executor. |
int |
getNumberOfIndexingThreads()
Returns the amount of threads the search service will be able to instanciate within its thread pool. |
java.lang.String |
getPreferedBackendNameFor(ResolvedResource resource)
Returns the prefered backend for an indexable resolved resource. |
ResourceTypeDescriptor |
getResourceTypeDescriptorByName(java.lang.String name)
Returns a resource type descriptor instance. |
SearchEngineBackend |
getSearchEngineBackendByName(java.lang.String name)
Returns a search engine plugin given its name. |
java.util.Map<java.lang.String,SearchEngineBackend> |
getSearchEngineBackends()
Returns registred search engine plugins. |
SearchPrincipal |
getSearchPrincipal(java.security.Principal principal)
Computes a search principal out from a principal instance. |
java.util.List<java.lang.String> |
getSupportedAnalyzersFor(java.lang.String backendName)
Returns the supported analyers for a given backend. |
java.util.List<java.lang.String> |
getSupportedFieldTypes(java.lang.String backendName)
Returns the supported fieldd types for a given backend. |
long |
getTotalCompletedIndexingTasks()
Returns the total number of completed indexing tasks. |
void |
index(IndexableResources sources,
boolean fulltext)
Adds / updates index(es) given an IndexableResources
instance. |
void |
index(ResolvedResources sources)
Adds / updates index(es) given ( ResolvedResources
This method is useful for performing the resource resolution outside the
search service. |
void |
invalidateComputedIndexableResourceConfs()
Invalidates the computed indexable resource confs. |
boolean |
isEnabled()
Is the search service enabled? |
boolean |
isReindexingAll()
Is the search service reindexing the while indexes? |
SearchServiceSession |
openSession()
Opens a new session against the search service. |
void |
registerContribution(java.lang.Object contribution,
java.lang.String extensionPoint,
ComponentInstance contributor)
|
void |
reindexAll(java.lang.String repoName,
java.lang.String path,
boolean fulltext)
Performs a full reindexing of the Nuxeo core repository given a Nuxeo core repository name and a path. |
void |
saveAllSessions()
Saves all the pending sessions. |
ResultSet |
searchQuery(ComposedNXQuery nxqlQuery,
int offset,
int range)
Searches results given an NXQL query. |
ResultSet |
searchQuery(NativeQuery nativeQuery,
int offset,
int range)
Searches results given a backend native query wrapper. |
ResultSet |
searchQuery(NativeQueryString queryString,
java.lang.String backendName,
int offset,
int range)
Searches results given a backend native query string. |
void |
setDefaultSearchEngineBackendName(java.lang.String backendName)
Sets the default backend given its name. |
void |
setIndexingDocBatchSize(int docBatchSize)
Sets the document batch size. |
void |
setNumberOfIndexingThreads(int numberOfIndexingThreads)
Sets the amount of threads the search service will be able to instanciate within its thread pool. |
void |
setReindexingAll(boolean flag)
Reindex all setter. |
void |
setStatus(boolean active)
Sets the status of the search service. |
void |
unindex(DocumentModel dm)
|
void |
unregisterContribution(java.lang.Object contribution,
java.lang.String extensionPoint,
ComponentInstance contributor)
|
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent |
---|
getAdapter, registerExtension, unregisterExtension |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final ComponentName NAME
public static final int DEFAULT_MAX_POOL_SIZE
public static final int DEFAULT_DOC_BATCH_SIZE
Constructor Detail |
---|
public SearchServiceImpl()
Method Detail |
---|
public void activate(ComponentContext context) throws java.lang.Exception
Component
This method is called by the runtime when a component is activated.
activate
in interface Component
activate
in class DefaultComponent
context
- the runtime context
java.lang.Exception
- if an error occurs during activationpublic void deactivate(ComponentContext context) throws java.lang.Exception
Component
This method is called by the runtime when a component is deactivated.
deactivate
in interface Component
deactivate
in class DefaultComponent
context
- the runtime context
java.lang.Exception
- if an error occurs during activationpublic final java.lang.String getDefaultSearchEngineBakendName()
SearchServiceInternals
It will be used as a fallback when no prefered backend are specified by a given resource.
Note, this is the backend responsability to register itself as default. And as well, the default backend can be overriden by another contributed backend. In this case, one can use the deployment order offered by Nuxeo runtime to ensure priority.
Returns null if no default backend registered.
getDefaultSearchEngineBakendName
in interface SearchServiceInternals
public final void setDefaultSearchEngineBackendName(java.lang.String backendName)
SearchServiceInternals
setDefaultSearchEngineBackendName
in interface SearchServiceInternals
backendName
- a search engine backend instance.public final java.lang.String getPreferedBackendNameFor(ResolvedResource resource)
SearchServiceInternals
getPreferedBackendNameFor
in interface SearchServiceInternals
resource
- an indexable resolved resource.
public void index(ResolvedResources sources) throws IndexingException
SearchService
ResolvedResources
This method is useful for performing the resource resolution outside the search service.
index
in interface SearchService
sources
- resolved resources
IndexingException
- wrap low level backend exceptionpublic void index(IndexableResources sources, boolean fulltext) throws IndexingException
SearchService
IndexableResources
instance.
The actual resolution in this case will be done search service side.
index
in interface SearchService
sources
- an IndexableResources instancefulltext
- do compute fulltext at resolution time
IndexingException
- wrap low level backend exceptionpublic void unindex(DocumentModel dm) throws IndexingException
unindex
in interface SearchService
IndexingException
public void clear() throws IndexingException
SearchService
clear
in interface SearchService
IndexingException
public void deleteAggregatedResources(java.lang.String key) throws IndexingException
SearchService
This will remove all resources indexed with
key as key used to identified the set ot resources. See
ResolvedResources.getId()
deleteAggregatedResources
in interface SearchService
key
- aggregated resources key.
IndexingException
public void deleteAtomicResource(java.lang.String key) throws IndexingException
SearchService
This will remove the resource identified by this resource key only.
deleteAtomicResource
in interface SearchService
key
- atomic resource key
IndexingException
public final SearchEngineBackend getSearchEngineBackendByName(java.lang.String name)
SearchServiceInternals
getSearchEngineBackendByName
in interface SearchServiceInternals
name
- : name of the search engine plugin.
public final java.util.Map<java.lang.String,SearchEngineBackend> getSearchEngineBackends()
SearchServiceInternals
getSearchEngineBackends
in interface SearchServiceInternals
public void registerContribution(java.lang.Object contribution, java.lang.String extensionPoint, ComponentInstance contributor)
registerContribution
in class DefaultComponent
public void unregisterContribution(java.lang.Object contribution, java.lang.String extensionPoint, ComponentInstance contributor)
unregisterContribution
in class DefaultComponent
public final IndexableResourceConf getIndexableResourceConfByName(java.lang.String name, boolean full)
SearchService
getIndexableResourceConfByName
in interface SearchService
name
- the name of the indexable resource configuration.full
- compute automatic configuration to get the full resource
configuration
public final IndexableResourceConf getIndexableResourceConfByPrefix(java.lang.String prefix, boolean full)
SearchService
getIndexableResourceConfByPrefix
in interface SearchService
prefix
- the prefix of the indexable resource configuration.full
- compute automatic configuration to get the full resource
configuration
public final java.util.Map<java.lang.String,IndexableResourceConf> getIndexableResourceConfs()
SearchService
getIndexableResourceConfs
in interface SearchService
public final java.util.Map<java.lang.String,IndexableDocType> getIndexableDocTypes()
SearchServiceInternals
getIndexableDocTypes
in interface SearchServiceInternals
public final IndexableDocType getIndexableDocTypeFor(java.lang.String docType)
SearchService
getIndexableDocTypeFor
in interface SearchService
docType
- doc type indentifier.
public java.util.List<java.lang.String> getSupportedAnalyzersFor(java.lang.String backendName)
SearchService
getSupportedAnalyzersFor
in interface SearchService
backendName
- the backend name.
public java.util.List<java.lang.String> getSupportedFieldTypes(java.lang.String backendName)
SearchService
getSupportedFieldTypes
in interface SearchService
backendName
- the backend name.
public ResultSet searchQuery(ComposedNXQuery nxqlQuery, int offset, int range) throws SearchException, QueryException
SearchService
searchQuery
in interface SearchService
nxqlQuery
- a NXQL query instanceoffset
- pagination startrange
- number of results
SearchException
- wrap low level backend exception
QueryException
- if the query is invalid or unsupportedpublic ResultSet searchQuery(NativeQuery nativeQuery, int offset, int range) throws SearchException, QueryException
SearchService
searchQuery
in interface SearchService
nativeQuery
- the backend native query wrapper.offset
- pagination startrange
- number of results
SearchException
- wrap low level backend exception
QueryException
- if the query is invalid or unsupportedpublic ResultSet searchQuery(NativeQueryString queryString, java.lang.String backendName, int offset, int range) throws SearchException, QueryException
SearchService
searchQuery
in interface SearchService
queryString
- the backend native query string wrapper.backendName
- the backened name to apply the query on. If backened
name is null then use the default indexing backendsoffset
- pagination startrange
- number of results
SearchException
- wrap low level backend exception
QueryException
- wrong query, rewrapped from backendpublic final java.lang.String[] getAvailableBackendNames()
SearchService
getAvailableBackendNames
in interface SearchService
public final IndexableResourceDataConf getIndexableDataConfFor(java.lang.String dataName)
SearchServiceInternals
For instance, a data name can be dc:title
getIndexableDataConfFor
in interface SearchServiceInternals
dataName
- the data name.
public final IndexableResourceDataConf getIndexableDataConfByName(java.lang.String name)
SearchServiceInternals
TODO This is a temporary helper for the current flat data model To be rethought
For instance, the name can be Title
while the data name is
dublincore:title
.
getIndexableDataConfByName
in interface SearchServiceInternals
name
- the data name.
public final SearchPrincipal getSearchPrincipal(java.security.Principal principal)
SearchService
NuxeoPrincipal instance is expected for groups support.
getSearchPrincipal
in interface SearchService
principal
- a java principal instance
public final boolean isEnabled()
SearchService
It is possible to disable the search service using extension point parameter.
isEnabled
in interface SearchService
public final void setStatus(boolean active)
SearchService
setStatus
in interface SearchService
active
- if active is true, then the service will be activatedpublic final FulltextFieldDescriptor getFullTextDescriptorByName(java.lang.String name)
SearchService
getFullTextDescriptorByName
in interface SearchService
name
- the prefixed name with what it's been registered
using extension point.
public IndexingEventConf getIndexingEventConfByName(java.lang.String name)
SearchService
getIndexingEventConfByName
in interface SearchService
name
- the name under which it's been registered using extension
point.
public final java.util.Set<java.lang.String> getDocumentTypeNamesForFacet(java.lang.String facet)
SearchServiceInternals
getDocumentTypeNamesForFacet
in interface SearchServiceInternals
facet
- the given facet
public java.util.Set<java.lang.String> getDocumentTypeNamesExtending(java.lang.String docType)
SearchServiceInternals
getDocumentTypeNamesExtending
in interface SearchServiceInternals
docType
- the base document type.
public final java.util.Set<java.lang.String> getDocumentTypeNamesForFacet(java.util.Collection<java.lang.String> facets)
SearchServiceInternals
getDocumentTypeNamesForFacet
in interface SearchServiceInternals
facets
- the given facets, as a collection
public final void invalidateComputedIndexableResourceConfs()
SearchService
Will be useful if Nuxeo Runtime supports hot deployment in the future.
invalidateComputedIndexableResourceConfs
in interface SearchService
public final BlobExtractor getBlobExtractorByName(java.lang.String name)
SearchService
getBlobExtractorByName
in interface SearchService
name
- the name against which the full text extractor has been
registered using extension point.
public ResourceTypeDescriptor getResourceTypeDescriptorByName(java.lang.String name)
SearchService
getResourceTypeDescriptorByName
in interface SearchService
name
- the resource type name which has been used with extension
point.
public long getIndexingWaitingQueueSize()
SearchService
getIndexingWaitingQueueSize
in interface SearchService
public int getNumberOfIndexingThreads()
SearchService
getNumberOfIndexingThreads
in interface SearchService
public void closeSession(java.lang.String sid)
SearchService
closeSession
in interface SearchService
sid
- the search service identifierpublic SearchServiceSession openSession()
SearchService
Warning: for now on the client is responsible for closing the session.
openSession
in interface SearchService
public int getIndexingDocBatchSize()
SearchService
In case of batch indexing we can choose to save the indexing session for a given amount of document. Default is one meaning the session is saved after every insertion. You might want to increase this while performing bulk document imports.
getIndexingDocBatchSize
in interface SearchService
public void setIndexingDocBatchSize(int docBatchSize)
SearchService
In case of batch indexing we can choose to save the indexing session for a given amount of document. Default is one meaning the session is saved after every insertion. You might want to increase this while performing bulk document imports.
setIndexingDocBatchSize
in interface SearchService
docBatchSize
- number of of document per indexing session before
save()public void setNumberOfIndexingThreads(int numberOfIndexingThreads)
SearchService
setNumberOfIndexingThreads
in interface SearchService
numberOfIndexingThreads
- : the number of threads maxpublic void saveAllSessions() throws IndexingException
SearchService
This is useful when using document batch size greater than 1 since if the amount of documents indexed are not an exact multiple of the document batch size then one might want to flush right now on demande the remaning resources in sessions before the next window size is reached.
saveAllSessions
in interface SearchService
IndexingException
public static CoreSession getCoreSession(java.lang.String repoName) throws IndexingException
IndexingException
public void reindexAll(java.lang.String repoName, java.lang.String path, boolean fulltext) throws IndexingException
SearchService
If path is null then the reindexing will be done from the root of the repository (i.e : "/").
reindexAll
in interface SearchService
repoName
- the Nuxeo Core repository name.fulltext
- whether or not we want to index fulltext.
IndexingException
public int getActiveIndexingTasks()
SearchService
getActiveIndexingTasks
in interface SearchService
public long getTotalCompletedIndexingTasks()
SearchService
If you want to use this API for monitoring purpose, you should be aware that the total number of indexing tasks is reinitialized when the component is loaded only. Thus you should keep track of this value before performing your indexing operation you want to keep track of.
getTotalCompletedIndexingTasks
in interface SearchService
public boolean isReindexingAll()
SearchService
isReindexingAll
in interface SearchService
public void setReindexingAll(boolean flag)
SearchService
setReindexingAll
in interface SearchService
flag
- bool flag
|
Nuxeo Enterprise Platform 5.4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |