@Singleton public class SearchService extends Object
Constructor and Description |
---|
SearchService() |
Modifier and Type | Method and Description |
---|---|
void |
createIndex(boolean force)
Initialize search indexes if not created yet, unless forced.
|
void |
doSearch(java.util.function.Consumer<org.hibernate.search.jpa.FullTextEntityManager> runner)
Perform full-text search.
|
List<Long> |
fullTextSearch(Class<? extends Model> entityType,
String searchText,
int limit)
Do full-text search on the given entity type with the given search text.
|
boolean |
isEnabled()
Whether full-text search support is enabled.
|
public boolean isEnabled()
public void createIndex(boolean force) throws InterruptedException
force
- if true, indexes will be re-created.InterruptedException
public void doSearch(java.util.function.Consumer<org.hibernate.search.jpa.FullTextEntityManager> runner)
runner
- the search runnerpublic List<Long> fullTextSearch(Class<? extends Model> entityType, String searchText, int limit) throws IOException
The method will do search in batches and apply security filter on them until max records are not found or there are no more records to search.
entityType
- the entity type to search onsearchText
- the search textlimit
- maximum number of resultIOException
- if any error reading indexes