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 String
protected final Map
<SearchIndex, IndexingJsonWriter> protected static final int
protected static final com.fasterxml.jackson.databind.ObjectMapper
protected static final String
protected final Map
<String, SearchIndex> protected final Map
<String, List<SearchIndex>> protected final Map
<String, SearchClient> protected static final String
-
Constructor Summary
ConstructorsConstructorDescriptionSearchServiceImpl
(List<SearchClientDescriptor> clients, List<SearchIndexDescriptor> indexes) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Waits for completion of indexing activity for testing purpose only.boolean
clearSearchScroll
(SearchScrollContext scrollContext) Explicit clear the search scroll context, without waiting for the scroll keep alive to timeout.Internal: Gets a given search client.Gets the default repository name.getDefaultSearchIndexForRepository
(String repository) Gets the defaultSearchIndex
for a given repository.Gets the set of repository names.getSearchIndexForRepository
(String repository) Gets the list ofSearchIndex
for a given repository.indexDocuments
(BulkIndexingRequest request) Internal: index documents.protected void
initIndexes
(SearchClient client, List<SearchIndexDescriptor> indexes) protected String
json
(IndexingJsonWriter writer, DocumentModel doc) protected DocumentModelList
loadDocuments
(CoreSession session, List<String> documentIds) protected DocumentModelList
loadDocumentsOneByOne
(CoreSession session, List<String> documentIds) protected void
void
refresh
(SearchIndex index) Refreshes an index so newly indexed documents are searchable.reindexDocuments
(String repository, String nxql) Internal: reindex documents of the given repository according to the given NXQL query.reindexRepository
(String repository) Internal: reindex the repositorysearch
(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, wait
Methods inherited from interface org.nuxeo.ecm.core.search.SearchService
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
-
repoToDefaultSearchIndex
-
repoToSearchIndexes
-
indexToJsonWriter
-
defaultRepository
-
-
Constructor Details
-
SearchServiceImpl
-
-
Method Details
-
initIndexes
-
getDefaultRepositoryName
Description copied from interface:SearchService
Gets the default repository name.- Specified by:
getDefaultRepositoryName
in interfaceSearchService
-
getRepositoryNames
Description copied from interface:SearchService
Gets the set of repository names.- Specified by:
getRepositoryNames
in interfaceSearchService
-
getDefaultSearchIndexForRepository
Description copied from interface:SearchService
Gets the defaultSearchIndex
for a given repository.- Specified by:
getDefaultSearchIndexForRepository
in interfaceSearchService
-
getSearchIndexForRepository
Description copied from interface:SearchService
Gets the list ofSearchIndex
for a given repository.- Specified by:
getSearchIndexForRepository
in interfaceSearchService
-
search
Description copied from interface:SearchService
Executes a search query.var response = searchService.search(SearchQuery.builder(session, "SELECT * FROM Document").build());
- Specified by:
search
in interfaceSearchService
-
searchScroll
Description copied from interface:SearchService
Iterate 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:
searchScroll
in interfaceSearchService
- Parameters:
scrollContext
- provided by the previousSearchResponse.getScrollContext()
;
-
clearSearchScroll
Description copied from interface:SearchService
Explicit clear the search scroll context, without waiting for the scroll keep alive to timeout.- Specified by:
clearSearchScroll
in interfaceSearchService
- Returns:
true
if the context is successfully cleared.
-
indexDocuments
Description copied from interface:SearchIndexingService
Internal: index documents.- Specified by:
indexDocuments
in interfaceSearchIndexingService
-
loadSources
-
loadDocuments
-
loadDocumentsOneByOne
-
json
-
reindexRepository
Description copied from interface:SearchIndexingService
Internal: reindex the repository- Specified by:
reindexRepository
in interfaceSearchIndexingService
- Returns:
- the bulk command id in charge of reindexing
-
reindexDocuments
Description copied from interface:SearchIndexingService
Internal: reindex documents of the given repository according to the given NXQL query.- Specified by:
reindexDocuments
in interfaceSearchIndexingService
- Returns:
- the bulk command id in charge of reindexing
-
refresh
Description copied from interface:SearchIndexingService
Refreshes an index so newly indexed documents are searchable.- Specified by:
refresh
in interfaceSearchIndexingService
-
getClient
Description copied from interface:SearchIndexingService
Internal: Gets a given search client.- Specified by:
getClient
in interfaceSearchIndexingService
-
await
Description copied from interface:SearchIndexingService
Waits for completion of indexing activity for testing purpose only.- Specified by:
await
in interfaceSearchIndexingService
- Parameters:
duration
- the duration to wait- Returns:
true
if all indexing processing completed orfalse
if one or more has not finished after the timeout- Throws:
InterruptedException
-