Add Advanced Search to a Project
Adding Advanced Search to a Project
Add the following dependencies to cms/cms-dependencies/pom.xml in your project:
<dependency> <groupId>com.onehippo.cms7</groupId> <artifactId>hippo-addon-advanced-search-frontend</artifactId> <type>pom</type> </dependency> <dependency> <groupId>com.onehippo.cms7</groupId> <artifactId>hippo-addon-advanced-search-repository</artifactId> </dependency>
Rebuild your project.
Configure the Document Types Filter Dropdown
Configure which document types can be selected in the filter section of the search perspective:
/hippo:configuration/hippo:frontend/cms/cms-advanced-search/genericFilters: document.type.namespaces: [ 'myproject' ] document.type.excluded: [ 'myproject:basedocument' ]
The above example includes all document types in the myproject namespace, except myproject:basedocument.
Note that when no document types are selected in the filter, the search results will include all document types regardless of the above configuration.
Configure Inclusion of Subtypes
By default, search results do not include subtypes of the document types selected in the search filter:
/hippo:configuration/hippo:frontend/cms/cms-advanced-search/genericFilters: document.subtypes.included: false
Set the document.subtypes.included property to true to include subtypes of selected document types in search results.
Configure Wildcard Postfixing
By default, Advanced Search applies wildcard postfixing to search terms of 3 characters or longer. This means that the search results will include documents that contain words starting with the search term. This behavior can be fine-tuned or completely disabled by configuring the Search Service used by Advanced Search to execute queries.
Configure Character Limit of Search Input
Since 13.2.0, the following property of type Long is available to limit the number of characters that is allowed in the main search input of the search perspective:
/hippo:configuration/hippo:frontend/cms/cms-static/advancedSearchPerspective: search.input.maxlength: 100
If the property is absent or does not have a positive value, no limit is set.