-
Notifications
You must be signed in to change notification settings - Fork 2
The SearchController
The result of a worklist or a search query is controlled by the Marty SearchController bean which extends the Imixs Workflow WorklistController class. The Marty SearchController is a session scoped backing bean providing mechanisms for performing a JPQL query as also a Lucene search. The SearchController provides a ItemCollection called searchfilter to be used to provide filter attributes.
The ViewResult is computed by a custom IViewHandler implemented as a inner class of the Marty SearchController. Depending on the provided attributes the Marty SearchController decides if a JPQL or a Lucene search is triggered. The queries for both are computed by a IQueryBuilder included in the Marty WorklistController .
For a fulltext search the searchquery is handled by the Imixs Workfow LucenePlugin. The plugin allows some configuration through the imixs.properties. Per default the lucene plugin uses a OR operator to search for multiple words.
For example
capital of Hungary results to an internal search phrase
capital OR of OR Hungary The default operator can be chanted to 'AND'. The above mentioned query is then parsed as
capital AND of AND Hungary To set the AND operator mode the imixs.properties param need to be set:
lucence.defaultOperator=OR This can be done by Administration->Configuration->additional properties. Or directly in the imixs.properties file.
You can provide a custom QueryBuilder to adapt the behavior of a search result . This is an example how to adapt the QueryBuilder
....
@Inject
private WorklistController worklistController;
public MyController() {
super();
worklistController.setQueryBuilder(new MyCustomQueryBuilder())
}
...
protected class MyCustomQueryBuilder implements IQueryBuilder {
@Override
public String getSearchQuery(ItemCollection searchFilter) {
String sSearchTerm = "";
Date date = searchFilter.getItemValueDate("datdate");
....
return sSearchTerm;
}
public String getJPQLStatement(ItemCollection queryFilter) {
String sQuery = "SELECT DISTINCT wi FROM Entity AS wi ";
.....
return sQuery;
}
}