Interface Query<T>
-
- Type Parameters:
T
-
- All Superinterfaces:
Executor<T>
,FieldOrSubFilter<T>
,Limit<T>
,OrderBy<T>
public interface Query<T> extends FieldOrSubFilter<T>, OrderBy<T>, Limit<T>
Search for business data values using different filters for text, number and date fields. The result can be ordered and limited.
Example:
import workflow.business.data.Dossier; List<Dossier> result = ivy.repo.search(Dossier.class) .textField("person.firstName").containsWordPattern("A*") .orderBy().field("person.lastName").descending() .limit(10) .execute() .getAll();
The method
score()
allows to build Google like searches. The returned result hits are by default ordered by score (best fit first). Note, some result may not match the complete query string but may also be relevant.Example:
This will return all dossiers that contain the wordsimport workflow.business.data.Dossier; List<Dossier> result = ivy.repo.search(Dossier.class) .score().allTextFields().query("Axon+Ivy~1") .limit(50) .execute() .getAll();
Axon
andIvy
but also dossiers whereIvy
is not spelled correct (e.g.Ivi
,Ify
, etc).Filters and score can be combined.
- API:
- This is a public API.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Result<T>
raw(String rawSearchQuery)
Search for business data values using a raw Elasticsearch search query.-
Methods inherited from interface ch.ivyteam.ivy.business.data.store.search.FieldOrSubFilter
allFields, dateTimeField, filter, not, numberField, textField, textFields
-
-
-
-
Method Detail
-
raw
Result<T> raw(String rawSearchQuery)
Search for business data values using a raw Elasticsearch search query.
Warning: The format of the raw search query string may change in future versions. Only use this method if you have to use a feature that is not support by the other
query
methods.Example:
import workflow.business.data.Dossier; List<Dossier> result = ivy.repo.search(Dossier.class).raw( "{\"size\":10,\"sort\":[{\"person.lastName\":\"desc\"}],\"query\":{\"bool\":{\"filter\":[{\"wildcard\":{\"person.firstName\":\"a*\"}}]}},\"_source\":{\"exclude\":[\"*\"]}}") .getAll();
- Parameters:
rawSearchQuery
- the raw elastic search query as json- Returns:
- search result
- See Also:
FieldOrSubFilter.allFields()
,FieldOrSubFilter.textField(String)
,FieldOrSubFilter.dateTimeField(String)
,FieldOrSubFilter.numberField(String)
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
-