Nuxeo Enterprise Platform 5.4

org.nuxeo.ecm.core.search.api.client
Interface SearchService

All Superinterfaces:
java.io.Serializable
All Known Subinterfaces:
SearchServiceInternals, SearchServiceLocal, SearchServiceRemote
All Known Implementing Classes:
SearchServiceBean, SearchServiceImpl

public interface SearchService
extends java.io.Serializable

Search service public interface.

Author:
Julien Anguenot

Method Summary
 void clear()
          Completely erases the indexes.
 void closeSession(java.lang.String sid)
          Closes a search service session given its identifier.
 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.
 FulltextFieldDescriptor getFullTextDescriptorByName(java.lang.String prefixedName)
          Returns the full text descriptor given its name.
 IndexableDocType getIndexableDocTypeFor(java.lang.String docType)
          Return the indexing information for a given nuxeo core doc type.
 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.
 ResourceTypeDescriptor getResourceTypeDescriptorByName(java.lang.String name)
          Returns a resource type descriptor instance.
 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 reindexAll(java.lang.String repoName, java.lang.String path, boolean fulltext)
          Deprecated. does nothing
 void saveAllSessions()
          Saves all the pending sessions.
 ResultSet searchQuery(ComposedNXQuery nxqlQuery, int offset, int range)
          Deprecated. use CoreSession#query instead
 ResultSet searchQuery(NativeQuery nativeQuery, int offset, int range)
          Deprecated. use CoreSession#query instead
 ResultSet searchQuery(NativeQueryString queryString, java.lang.String backendName, int offset, int range)
          Deprecated. use CoreSession#query instead
 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)
           
 

Method Detail

openSession

SearchServiceSession openSession()
Opens a new session against the search service.

Warning: for now on the client is responsible for closing the session.

Returns:
a search service session.

closeSession

void closeSession(java.lang.String sid)
Closes a search service session given its identifier.

Parameters:
sid - the search service identifier

saveAllSessions

void saveAllSessions()
                     throws IndexingException
Saves all the pending sessions.

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.

Throws:
IndexingException

isEnabled

boolean isEnabled()
Is the search service enabled?

It is possible to disable the search service using extension point parameter.

Returns:
true if active / false if inactive.

setStatus

void setStatus(boolean active)
Sets the status of the search service.

Parameters:
active - if active is true, then the service will be activated

index

void index(IndexableResources sources,
           boolean fulltext)
           throws IndexingException
Adds / updates index(es) given an IndexableResources instance.

The actual resolution in this case will be done search service side.

Parameters:
sources - an IndexableResources instance
fulltext - do compute fulltext at resolution time
Throws:
IndexingException - wrap low level backend exception

index

void index(ResolvedResources sources)
           throws IndexingException
Adds / updates index(es) given (ResolvedResources

This method is useful for performing the resource resolution outside the search service.

Parameters:
sources - resolved resources
Throws:
IndexingException - wrap low level backend exception

unindex

void unindex(DocumentModel dm)
             throws IndexingException
Throws:
IndexingException

clear

void clear()
           throws IndexingException
Completely erases the indexes.

Throws:
IndexingException

deleteAggregatedResources

void deleteAggregatedResources(java.lang.String key)
                               throws IndexingException
Deletes an index given an aggregated resources key.

This will remove all resources indexed with key as key used to identified the set ot resources. See ResolvedResources.getId()

Parameters:
key - aggregated resources key.
Throws:
IndexingException

deleteAtomicResource

void deleteAtomicResource(java.lang.String key)
                          throws IndexingException
Deletes an atomic resource given its key.

This will remove the resource identified by this resource key only.

Parameters:
key - atomic resource key
Throws:
IndexingException

searchQuery

@Deprecated
ResultSet searchQuery(ComposedNXQuery nxqlQuery,
                                 int offset,
                                 int range)
                      throws SearchException,
                             QueryException
Deprecated. use CoreSession#query instead

Searches results given an NXQL query.

Parameters:
nxqlQuery - a NXQL query instance
offset - pagination start
range - number of results
Returns:
a ResultSet instance
Throws:
SearchException - wrap low level backend exception
QueryException - if the query is invalid or unsupported

searchQuery

@Deprecated
ResultSet searchQuery(NativeQuery nativeQuery,
                                 int offset,
                                 int range)
                      throws SearchException,
                             QueryException
Deprecated. use CoreSession#query instead

Searches results given a backend native query wrapper.

Parameters:
nativeQuery - the backend native query wrapper.
offset - pagination start
range - number of results
Returns:
a result set instance
Throws:
SearchException - wrap low level backend exception
QueryException - if the query is invalid or unsupported

searchQuery

@Deprecated
ResultSet searchQuery(NativeQueryString queryString,
                                 java.lang.String backendName,
                                 int offset,
                                 int range)
                      throws SearchException,
                             QueryException
Deprecated. use CoreSession#query instead

Searches results given a backend native query string.

Parameters:
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 backends
offset - pagination start
range - number of results
Returns:
a result set instance
Throws:
SearchException - wrap low level backend exception
QueryException - wrong query, rewrapped from backend

getSupportedAnalyzersFor

java.util.List<java.lang.String> getSupportedAnalyzersFor(java.lang.String backendName)
Returns the supported analyers for a given backend.

Parameters:
backendName - the backend name.
Returns:
a list of identifiers.

getSupportedFieldTypes

java.util.List<java.lang.String> getSupportedFieldTypes(java.lang.String backendName)
Returns the supported fieldd types for a given backend.

Parameters:
backendName - the backend name.
Returns:
a list of identifiers.

getIndexableDocTypeFor

IndexableDocType getIndexableDocTypeFor(java.lang.String docType)
Return the indexing information for a given nuxeo core doc type.

Parameters:
docType - doc type indentifier.
Returns:
an indexable doc type instance.

getIndexableResourceConfByName

IndexableResourceConf getIndexableResourceConfByName(java.lang.String name,
                                                     boolean full)
Returns an indexable resource configuration given its name.

Parameters:
name - the name of the indexable resource configuration.
full - compute automatic configuration to get the full resource configuration
Returns:
an indexable resource configuration instance given its name.

getIndexableResourceConfByPrefix

IndexableResourceConf getIndexableResourceConfByPrefix(java.lang.String prefix,
                                                       boolean full)
Returns an indexable resource configuration given its prefix.

Parameters:
prefix - the prefix of the indexable resource configuration.
full - compute automatic configuration to get the full resource configuration
Returns:
an indexable resource configuration instance given its name.

getIndexableResourceConfs

java.util.Map<java.lang.String,IndexableResourceConf> getIndexableResourceConfs()
Returns all the indexable resource configurations registred.

Returns:
the a map from indexable resource configuration name to indexable resource configuration instance.

getAvailableBackendNames

java.lang.String[] getAvailableBackendNames()
Returns the list of all backend names.

Returns:
the list of all backend names.

getSearchPrincipal

SearchPrincipal getSearchPrincipal(java.security.Principal principal)
Computes a search principal out from a principal instance.

NuxeoPrincipal instance is expected for groups support.

Parameters:
principal - a java principal instance
Returns:
a search principal instance

getFullTextDescriptorByName

FulltextFieldDescriptor getFullTextDescriptorByName(java.lang.String prefixedName)
Returns the full text descriptor given its name.

Parameters:
prefixedName - the prefixed name with what it's been registered using extension point.
Returns:
a full text field descriptor.

getIndexingEventConfByName

IndexingEventConf getIndexingEventConfByName(java.lang.String name)
Returns an indexing event configuration given its name.

Parameters:
name - the name under which it's been registered using extension point.
Returns:
the configuration object.

invalidateComputedIndexableResourceConfs

void invalidateComputedIndexableResourceConfs()
Invalidates the computed indexable resource confs.

Will be useful if Nuxeo Runtime supports hot deployment in the future.


getBlobExtractorByName

BlobExtractor getBlobExtractorByName(java.lang.String name)
Returns a blob extractor given its name.

Parameters:
name - the name against which the full text extractor has been registered using extension point.
Returns:

getResourceTypeDescriptorByName

ResourceTypeDescriptor getResourceTypeDescriptorByName(java.lang.String name)
Returns a resource type descriptor instance.

Parameters:
name - the resource type name which has been used with extension point.
Returns:
a resource type descriptor instance

getNumberOfIndexingThreads

int getNumberOfIndexingThreads()
Returns the amount of threads the search service will be able to instanciate within its thread pool.

Returns:
the number of threads max

getIndexingWaitingQueueSize

long getIndexingWaitingQueueSize()
Returns the number of indexing tasks waiting for a slot in the ThreadPool executor.

Returns:

setNumberOfIndexingThreads

void setNumberOfIndexingThreads(int numberOfIndexingThreads)
Sets the amount of threads the search service will be able to instanciate within its thread pool.

Parameters:
numberOfIndexingThreads - : the number of threads max

getIndexingDocBatchSize

int getIndexingDocBatchSize()
Returns the document batch size.

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.

Returns:
number of of document per indexing session before save()

setIndexingDocBatchSize

void setIndexingDocBatchSize(int docBatchSize)
Sets the document batch size.

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.

Parameters:
docBatchSize - number of of document per indexing session before save()

reindexAll

@Deprecated
void reindexAll(java.lang.String repoName,
                           java.lang.String path,
                           boolean fulltext)
                throws IndexingException
Deprecated. does nothing

Performs a full reindexing of the Nuxeo core repository given a Nuxeo core repository name and a path.

If path is null then the reindexing will be done from the root of the repository (i.e : "/").

Parameters:
repoName - the Nuxeo Core repository name.
fulltext - whether or not we want to index fulltext.
Throws:
IndexingException

isReindexingAll

boolean isReindexingAll()
Is the search service reindexing the while indexes?

Returns:
a flag

setReindexingAll

void setReindexingAll(boolean flag)
Reindex all setter.

Parameters:
flag - bool flag

getActiveIndexingTasks

int getActiveIndexingTasks()
Returns the number of running indexing tasks.

Returns:
the number of actively running indexing tasks

getTotalCompletedIndexingTasks

long getTotalCompletedIndexingTasks()
Returns the total number of completed indexing tasks.

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.

Returns:
the total number of commpleted indexing tasks.

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.