Package org.nuxeo.ecm.core.search
Class SearchServiceImpl
java.lang.Object
org.nuxeo.ecm.core.search.SearchServiceImpl
- All Implemented Interfaces:
SearchIndexingService,SearchService
- Since:
- 2025.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Stringprotected final Map<String, IndexingJsonWriter> protected static final intprotected static final com.fasterxml.jackson.databind.ObjectMapperprotected static final Stringprotected final Map<String, SearchClient> protected final Map<String, SearchIndex> protected static final String -
Constructor Summary
ConstructorsConstructorDescriptionSearchServiceImpl(List<SearchClientDescriptor> clients, List<SearchIndexDescriptor> indexes) -
Method Summary
Modifier and TypeMethodDescriptionbooleanWaits for completion of all indexing activities.protected voidcheckAllIndexInRepo(String repository, List<String> indexNames) booleanclearSearchScroll(SearchScrollContext scrollContext) Explicit clear the search scroll context, without waiting for the scroll keep alive to timeout.Internal: Retrieves a search client by name.getDefaultIndexName(String repository) Gets the default index for the given repository.Gets the default repository name.getDefaultSearchIndexForRepository(String repository) Gets the defaultSearchIndexfor a given repository.getIndexNames(String repository) Gets all available indexes for a repository.Gets the set of repository names.getSearchIndex(String indexName) Gets the SearchIndex for the given index name.getSearchIndexForRepository(String repository) Gets the list ofSearchIndexfor a given repository.indexDocuments(BulkIndexingRequest request) Internal: Indexes documents according to the specified bulk indexing request.protected Stringjson(IndexingJsonWriter writer, DocumentModel doc) protected DocumentModelListloadDocuments(CoreSession session, List<String> documentIds) protected DocumentModelListloadDocumentsOneByOne(CoreSession session, List<String> documentIds) protected voidvoidrefresh(SearchIndex index) Refreshes a search index to make newly indexed documents immediately searchable.reindexDocuments(String repository, String nxql, long queryLimit) Reindexes documents matching the specified NXQL query up to the given limit for all search indexes of the repository.reindexDocuments(String repository, String nxql, long queryLimit, List<String> indexNames) Reindexes documents matching the specified NXQL query for the given limit only for the specified indexes.reindexRepository(String repository) Internal: Reindexes the entire repository by dropping and recreating all associated search indexes.reindexRepository(String repository, List<String> indexNames) Internal: Reindexes the entire repository by dropping and recreating the given search indexes.search(SearchQuery query) Executes a search query.searchScroll(SearchScrollContext scrollContext) Iterate on results for a scroll search.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.nuxeo.ecm.core.search.SearchIndexingService
reindexDocumentsMethods inherited from interface org.nuxeo.ecm.core.search.SearchService
getDefaultIndexName, getDefaultSearchIndex
-
Field Details
-
LOAD_SOURCES_TIMEOUT
protected static final int LOAD_SOURCES_TIMEOUT -
MAPPER
protected static final com.fasterxml.jackson.databind.ObjectMapper MAPPER -
SELECT_DOCUMENTS_IN
- See Also:
-
NXQL_ALL_DOCUMENTS
- See Also:
-
searchClients
-
searchIndexes
-
repoToDefaultIndex
-
repoToIndexes
-
indexToJsonWriter
-
defaultRepository
-
-
Constructor Details
-
SearchServiceImpl
-
-
Method Details
-
getDefaultRepositoryName
Description copied from interface:SearchServiceGets the default repository name.- Specified by:
getDefaultRepositoryNamein interfaceSearchService
-
getRepositoryNames
Description copied from interface:SearchServiceGets the set of repository names.- Specified by:
getRepositoryNamesin interfaceSearchService
-
getDefaultIndexName
Description copied from interface:SearchServiceGets the default index for the given repository.- Specified by:
getDefaultIndexNamein interfaceSearchService
-
getIndexNames
Description copied from interface:SearchServiceGets all available indexes for a repository.- Specified by:
getIndexNamesin interfaceSearchService
-
getSearchIndex
Description copied from interface:SearchServiceGets the SearchIndex for the given index name.- Specified by:
getSearchIndexin interfaceSearchService
-
getDefaultSearchIndexForRepository
Description copied from interface:SearchServiceGets the defaultSearchIndexfor a given repository.- Specified by:
getDefaultSearchIndexForRepositoryin interfaceSearchService
-
getSearchIndexForRepository
Description copied from interface:SearchServiceGets the list ofSearchIndexfor a given repository.- Specified by:
getSearchIndexForRepositoryin interfaceSearchService
-
search
Description copied from interface:SearchServiceExecutes a search query.var response = searchService.search(SearchQuery.builder("SELECT * FROM Document", session).build());- Specified by:
searchin interfaceSearchService
-
searchScroll
Description copied from interface:SearchServiceIterate on results for a scroll search. The end of scroll is reached when there is no more hit, i.e.SearchResponse.getHitsCount()returns0.- Specified by:
searchScrollin interfaceSearchService- Parameters:
scrollContext- provided by the previousSearchResponse.getScrollContext();
-
clearSearchScroll
Description copied from interface:SearchServiceExplicit clear the search scroll context, without waiting for the scroll keep alive to timeout.- Specified by:
clearSearchScrollin interfaceSearchService- Returns:
trueif the context is successfully cleared.
-
indexDocuments
Description copied from interface:SearchIndexingServiceInternal: Indexes documents according to the specified bulk indexing request.- Specified by:
indexDocumentsin interfaceSearchIndexingService- Parameters:
request- the bulk indexing request containing documents to index- Returns:
- the indexing response with operation details
-
loadSources
-
loadDocuments
-
loadDocumentsOneByOne
-
json
-
reindexRepository
Description copied from interface:SearchIndexingServiceInternal: Reindexes the entire repository by dropping and recreating all associated search indexes.- Specified by:
reindexRepositoryin interfaceSearchIndexingService- Parameters:
repository- the repository name- Returns:
- the bulk command id for the reindexing operation
-
reindexRepository
Description copied from interface:SearchIndexingServiceInternal: Reindexes the entire repository by dropping and recreating the given search indexes.- Specified by:
reindexRepositoryin interfaceSearchIndexingService- Parameters:
indexNames- the list of indexes to reindex, all indexes must be on the same repository- Returns:
- the bulk command id for the reindexing operation
-
reindexDocuments
Description copied from interface:SearchIndexingServiceReindexes documents matching the specified NXQL query up to the given limit for all search indexes of the repository.- Specified by:
reindexDocumentsin interfaceSearchIndexingService- Parameters:
repository- the repository namenxql- the NXQL query to select documentsqueryLimit- maximum number of documents to index, or -1 for no limit- Returns:
- the bulk command id for the reindexing operation
-
reindexDocuments
public String reindexDocuments(String repository, String nxql, long queryLimit, List<String> indexNames) Description copied from interface:SearchIndexingServiceReindexes documents matching the specified NXQL query for the given limit only for the specified indexes.- Specified by:
reindexDocumentsin interfaceSearchIndexingService- Parameters:
repository- the repository namenxql- the NXQL query to select documentsqueryLimit- maximum number of documents to index, or -1 for no limitindexNames- search indexes to reindex, all search indexes must point to the same repository- Returns:
- the bulk command id for the reindexing operation
-
checkAllIndexInRepo
-
refresh
Description copied from interface:SearchIndexingServiceRefreshes a search index to make newly indexed documents immediately searchable.- Specified by:
refreshin interfaceSearchIndexingService- Parameters:
index- the search index to refresh
-
getClient
Description copied from interface:SearchIndexingServiceInternal: Retrieves a search client by name.- Specified by:
getClientin interfaceSearchIndexingService- Parameters:
clientName- the name of the search client- Returns:
- the search client instance
-
await
Description copied from interface:SearchIndexingServiceWaits for completion of all indexing activities. Intended for testing purposes only.- Specified by:
awaitin interfaceSearchIndexingService- Parameters:
duration- the maximum duration to wait- Returns:
trueif all indexing operations completed,falseif timeout occurred- Throws:
InterruptedException- if the current thread is interrupted while waiting
-