|
Nuxeo Enterprise Platform 5.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nuxeo.runtime.model.DefaultComponent
org.nuxeo.ecm.core.search.service.SearchServiceImpl
public class SearchServiceImpl
Nuxeo core search service implementation.
SearchService,
Serialized Form| Field Summary | |
|---|---|
static int |
DEFAULT_DOC_BATCH_SIZE
|
static int |
DEFAULT_MAX_POOL_SIZE
|
static ComponentName |
NAME
|
| Fields inherited from interface org.nuxeo.ecm.core.search.api.client.SearchService |
|---|
INDEXABLE_FACET |
| Constructor Summary | |
|---|---|
SearchServiceImpl()
|
|
| Method Summary | |
|---|---|
void |
clear()
Completely erases the indexes. |
void |
closeSession(String sid)
Closes a search service session given its identifier. |
void |
deleteAggregatedResources(String key)
Deletes an index given an aggregated resources key |
void |
deleteAtomicResource(String key)
Deletes an atomic resource given its key. |
int |
getActiveIndexingTasks()
Returns the number of running indexing tasks. |
String[] |
getAvailableBackendNames()
Returns the list of all backend names. |
BlobExtractor |
getBlobExtractorByName(String name)
Returns a blob extractor given its name. |
CoreSession |
getCoreSession(String repoName)
|
protected SearchEngineBackend |
getDefaultBackend()
Returns the default backend registered for this search service instance. |
String |
getDefaultSearchEngineBakendName()
Returns the default backend. |
Set<String> |
getDocumentTypeNamesExtending(String docType)
Return the names of core document types extending the given one, which is included. |
Set<String> |
getDocumentTypeNamesForFacet(Collection<String> facets)
Returns the set of document types bearing one of given facets. |
Set<String> |
getDocumentTypeNamesForFacet(String facet)
Returns the set of document types bearing a given facet. |
FulltextFieldDescriptor |
getFullTextDescriptorByName(String name)
Returns the full text descriptor given its name. |
IndexableResourceDataConf |
getIndexableDataConfByName(String name)
Returns the indexing data conf by its name. |
IndexableResourceDataConf |
getIndexableDataConfFor(String dataName)
Returns the indexing data conf for a given data name. |
IndexableDocType |
getIndexableDocTypeFor(String docType)
Return the indexing information for a given nuxeo core doc type. |
Map<String,IndexableDocType> |
getIndexableDocTypes()
Returns a map from doc type to indexable doc types. |
IndexableResourceConf |
getIndexableResourceConfByName(String name,
boolean full)
Returns an indexable resource configuration given its name. |
IndexableResourceConf |
getIndexableResourceConfByPrefix(String prefix,
boolean full)
Returns an indexable resource configuration given its prefix. |
Map<String,IndexableResourceConf> |
getIndexableResourceConfs()
Returns all the indexable resource configurations registred. |
int |
getIndexingDocBatchSize()
Returns the document batch size. |
IndexingEventConf |
getIndexingEventConfByName(String name)
Returns an indexing event configuration given its name. |
int |
getNumberOfIndexingThreads()
Returns the amount of threads the search service will be able to instanciate within its thread pool. |
String |
getPreferedBackendNameFor(ResolvedResource resource)
Returns the prefered backend for an indexable resolved resource. |
ResourceTypeDescriptor |
getResourceTypeDescriptorByName(String name)
Returns a resource type descriptor instance. |
SearchEngineBackend |
getSearchEngineBackendByName(String name)
Returns a search engine plugin given its name. |
Map<String,SearchEngineBackend> |
getSearchEngineBackends()
Returns registred search engine plugins. |
SearchPrincipal |
getSearchPrincipal(Principal principal)
Computes a search principal out from a principal instance. |
List<String> |
getSupportedAnalyzersFor(String backendName)
Returns the supported analyers for a given backend. |
List<String> |
getSupportedFieldTypes(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)
Add / update index(es) given an IndexableResources
instance. |
void |
index(ResolvedResources sources)
Ad / update index(es) given ( ResolvedResources |
void |
indexInThread(DocumentModel dm,
Boolean recursive,
boolean fulltext)
Add / index in a separated thread a document model instance. |
void |
indexInThread(ResolvedResources sources)
Add / index in a separated thread a resolved resources. |
void |
invalidateComputedIndexableResourceConfs()
Invalidates the computed indexable resource confs. |
boolean |
isEnabled()
Is the search service enabled. |
SearchServiceSession |
openSession()
Opens a new session against the search service. |
void |
registerContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor)
|
void |
reindexAll(String repoName,
String path,
boolean fulltext)
Perform a full reindexing of the nuxeo core repository given a Nuxeo core repository name and a path. |
void |
saveAllSessions()
Save all 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,
String backendName,
int offset,
int range)
Searches results given a backend native query string. |
void |
setDefaultSearchEngineBackendName(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 |
setStatus(boolean active)
Set the status of the search service. |
void |
unregisterContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor)
|
| Methods inherited from class org.nuxeo.runtime.model.DefaultComponent |
|---|
activate, deactivate, getAdapter, registerExtension, unregisterExtension |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, 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 final String getDefaultSearchEngineBakendName()
SearchServiceInternalsIt 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 SearchServiceInternalspublic final void setDefaultSearchEngineBackendName(String backendName)
SearchServiceInternals
setDefaultSearchEngineBackendName in interface SearchServiceInternalsbackendName - a search engine backend instance.public final String getPreferedBackendNameFor(ResolvedResource resource)
SearchServiceInternals
getPreferedBackendNameFor in interface SearchServiceInternalsresource - an indexable resolved resource.
protected SearchEngineBackend getDefaultBackend()
SearchEngineBackend instance
public void index(ResolvedResources sources)
throws IndexingException
SearchServiceResolvedResources
This method is useful to perform the resource resolution outside the search service.
index in interface SearchServicesources - : resolved resources
IndexingException - wrap low level backend exception
public void index(IndexableResources sources,
boolean fulltext)
throws IndexingException
SearchServiceIndexableResources
instance.
The actual resolution in this case will be done search service side.
index in interface SearchServicesources - : an IndexableResources instancefulltext - : do compute fulltext at resolution time.
IndexingException - wrap low level backend exception
public void clear()
throws IndexingException
SearchService
clear in interface SearchServiceIndexingException
public void deleteAggregatedResources(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 SearchServicekey - : aggregated resources key.
IndexingException
public void deleteAtomicResource(String key)
throws IndexingException
SearchServiceThis will remove the resource identified by this resource key only.
deleteAtomicResource in interface SearchServicekey - : atomic resource key
IndexingExceptionpublic final SearchEngineBackend getSearchEngineBackendByName(String name)
SearchServiceInternals
getSearchEngineBackendByName in interface SearchServiceInternalsname - : name of the search engine plugin.
public final Map<String,SearchEngineBackend> getSearchEngineBackends()
SearchServiceInternals
getSearchEngineBackends in interface SearchServiceInternals
public void registerContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor)
registerContribution in class DefaultComponent
public void unregisterContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor)
unregisterContribution in class DefaultComponent
public final IndexableResourceConf getIndexableResourceConfByName(String name,
boolean full)
SearchService
getIndexableResourceConfByName in interface SearchServicename - : the name of the indexable resource configuration.full - : compute automatic configuration to get the full resource
configuration
public final IndexableResourceConf getIndexableResourceConfByPrefix(String prefix,
boolean full)
SearchService
getIndexableResourceConfByPrefix in interface SearchServiceprefix - : the prefix of the indexable resource configuration.full - compute automatic configuration to get the full resource
configuration
public final Map<String,IndexableResourceConf> getIndexableResourceConfs()
SearchService
getIndexableResourceConfs in interface SearchServicepublic final Map<String,IndexableDocType> getIndexableDocTypes()
SearchServiceInternals
getIndexableDocTypes in interface SearchServiceInternalspublic final IndexableDocType getIndexableDocTypeFor(String docType)
SearchService
getIndexableDocTypeFor in interface SearchServicedocType - : doc type indentifier.
public List<String> getSupportedAnalyzersFor(String backendName)
SearchService
getSupportedAnalyzersFor in interface SearchServicebackendName - : the backend name.
public List<String> getSupportedFieldTypes(String backendName)
SearchService
getSupportedFieldTypes in interface SearchServicebackendName - : the backend name.
public ResultSet searchQuery(ComposedNXQuery nxqlQuery,
int offset,
int range)
throws SearchException,
QueryException
SearchService
searchQuery in interface SearchServiceoffset - : pagination startrange - : number of results.
SearchException - wrap low level backend exception
QueryException - if the query is invalid or unsupported
public ResultSet searchQuery(NativeQuery nativeQuery,
int offset,
int range)
throws SearchException,
QueryException
SearchService
searchQuery in interface SearchServicenativeQuery - : the backend native query wrapper.offset - : pagination startrange - : number of results.
SearchException - wrap low level backend exception
QueryException - if the query is invalid or unsupported
public ResultSet searchQuery(NativeQueryString queryString,
String backendName,
int offset,
int range)
throws SearchException,
QueryException
SearchService
searchQuery in interface SearchServicequeryString - : 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 String[] getAvailableBackendNames()
SearchService
getAvailableBackendNames in interface SearchServicepublic final IndexableResourceDataConf getIndexableDataConfFor(String dataName)
SearchServiceInternals
For instance, a data name can be dc:title
getIndexableDataConfFor in interface SearchServiceInternalsdataName - the data name.
public final IndexableResourceDataConf getIndexableDataConfByName(String name)
SearchServiceInternalsTODO 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 SearchServiceInternalsname - the data name.
public final SearchPrincipal getSearchPrincipal(Principal principal)
SearchServiceNuxeoPrincipal instance is expected for groups support.
getSearchPrincipal in interface SearchServiceprincipal - : a java principal instance
public final boolean isEnabled()
SearchServicePossible to disable the search service using extension point parameter.
isEnabled in interface SearchServicepublic final void setStatus(boolean active)
SearchService
setStatus in interface SearchServiceactive - : if active is true then the service will be activatedpublic final FulltextFieldDescriptor getFullTextDescriptorByName(String name)
SearchService
getFullTextDescriptorByName in interface SearchServicename - : the prefixed name with what it's been registered
using extension point.
public IndexingEventConf getIndexingEventConfByName(String name)
SearchService
getIndexingEventConfByName in interface SearchServicename - : the name under which it's been registered using extension
point.
public final Set<String> getDocumentTypeNamesForFacet(String facet)
SearchServiceInternals
getDocumentTypeNamesForFacet in interface SearchServiceInternalsfacet - the given facet
public Set<String> getDocumentTypeNamesExtending(String docType)
SearchServiceInternals
getDocumentTypeNamesExtending in interface SearchServiceInternalsdocType - the base document type.
public final Set<String> getDocumentTypeNamesForFacet(Collection<String> facets)
SearchServiceInternals
getDocumentTypeNamesForFacet in interface SearchServiceInternalsfacets - the given facets, as a collection
public final void invalidateComputedIndexableResourceConfs()
SearchServiceWill be useful if Nuxeo Runtime supports hot deployment in the future.
invalidateComputedIndexableResourceConfs in interface SearchServicepublic final BlobExtractor getBlobExtractorByName(String name)
SearchService
getBlobExtractorByName in interface SearchServicename - : the name against which the full text extractor has been
registered using extension point.
public ResourceTypeDescriptor getResourceTypeDescriptorByName(String name)
SearchService
getResourceTypeDescriptorByName in interface SearchServicename - : the resource type name which has been used with extension
point.
public int getNumberOfIndexingThreads()
SearchService
getNumberOfIndexingThreads in interface SearchService
public void indexInThread(DocumentModel dm,
Boolean recursive,
boolean fulltext)
throws IndexingException
SearchServiceWe need to invoke the service to reach the thread pool as the ppol
indexInThread in interface SearchServicedm - : a Nuxeo Core document model instance.recursive - : perform an indexing recursion on this document model
childrenfulltext - : Do compute fulltext along with other metadata.
IndexingException - : in case of thread pool internal error.public void closeSession(String sid)
SearchService
closeSession in interface SearchServicesid - : the search service identifierpublic SearchServiceSession openSession()
SearchServiceAttention, for now the client is responsible of the session closure...
openSession in interface SearchServicepublic int getIndexingDocBatchSize()
SearchServiceIn 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 SearchServicepublic void setIndexingDocBatchSize(int docBatchSize)
SearchServiceIn 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 SearchServicedocBatchSize - : number of of document per indexing session before
save()public void setNumberOfIndexingThreads(int numberOfIndexingThreads)
SearchService
setNumberOfIndexingThreads in interface SearchServicenumberOfIndexingThreads - : the number of threads max
public void saveAllSessions()
throws IndexingException
SearchServiceThis 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 SearchServiceIndexingException
public CoreSession getCoreSession(String repoName)
throws IndexingException
IndexingException
public void reindexAll(String repoName,
String path,
boolean fulltext)
throws IndexingException
SearchServiceIf path is null then the reindexing will be done from the root of the repository (i.e : "/")
reindexAll in interface SearchServicerepoName - : the Nuxeo Core repository name.fulltext - : whether or not we want to index fulltext.
IndexingExceptionpublic int getActiveIndexingTasks()
SearchService
getActiveIndexingTasks in interface SearchServicepublic long getTotalCompletedIndexingTasks()
SearchServiceIf you wanna 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 void indexInThread(ResolvedResources sources)
throws IndexingException
SearchServiceWe need to invoke the service to reach the thread pool as the ppol
indexInThread in interface SearchServicesources - : resolved resources
IndexingException - : in case of thread pool internal error.
|
Nuxeo Enterprise Platform 5.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||