Package sonia.scm.search
Interface SearchEngine.ForType<T>
- Type Parameters:
T
- type of searchable objects
- Enclosing interface:
- SearchEngine
public static interface SearchEngine.ForType<T>
Search and index api.
- Since:
- 2.23.0
-
Method Summary
Modifier and TypeMethodDescriptionforResource
(String resource) Apply a lock for a specific resource.default SearchEngine.ForType<T>
forResource
(ModelObject resource) This method is a shortcut forforResource(String)
with the id of the given resource.search()
Returns a query builder object which can be used to search the index.void
Submits a task to update the index.void
update
(SerializableIndexTask<T> task) Submits a task to update the index.Name of the index which should be used.
-
Method Details
-
withIndex
Name of the index which should be used. If not specified the default index will be used.- Parameters:
name
- name of index- Returns:
this
-
forResource
Apply a lock for a specific resource. By default, a lock for the whole index is used. If one or more specific resources are locked, then the lock is applied only for those resources and tasks which target other resources of the same index can run in parallel.- Parameters:
resource
- specific resource to lock- Returns:
this
-
forResource
This method is a shortcut forforResource(String)
with the id of the given resource.- Parameters:
resource
- resource in form of model object- Returns:
this
-
update
Submits a task to update the index. The task is executed asynchronously and will finish at some unknown point in the future. Note: the task must be serializable because it is submitted to theCentralWorkQueue
, for more information about the task serialization have a look at theCentralWorkQueue
documentation.- Parameters:
task
- serializable task for updating the index
-
update
Submits a task to update the index. The task is executed asynchronous and will be finished some time in the future.- Parameters:
task
- task for updating multiple indices
-
search
QueryBuilder<T> search()Returns a query builder object which can be used to search the index.
-