Full-Text Search
Full-Text search is implemented in v5 using hibernate-search.
Right now only name fields are searched except files (DMSFile
and MetaFile
).
The global search box on grid view is used to make full-text search.
Configuration
To enable full-text support, provide following configuration:
hibernate.search.default.directory_provider = filesystem
hibernate.search.default.indexBase = {user.home}/.axelor/indexes
Customization
By default, only files and users are. The application has to provide custom index configuration using
hibernate search api by providing an implementation of com.axelor.db.search.SearchMappingContributor
.
Example
@Singleton
public class MySearchMappingContributor implements SearchMappingContributor {
@Override
public void contribute(SearchMapping mapping) {
// index contacts
mapping.entity(Contact.class)
.indexed().indexName("contact")
.property("fullName", ElementType.FIELD).field()
.property("addresses", ElementType.FIELD).indexEmbedded();
}
}
and in your bind it from app’s module class:
public class DemoModule extends AxelorModule {
@Override
protected void configure() {
bind(SearchMappingContributor.class).to(MySearchMappingContributor.class);
}
}
See hibernate-search docs for more details.