I am using dspace 4.x XMLUI version. I want to add new filter type like "Type of Learning Material","Education Level"etc. in the discovery search filter list(not in sidebar facet). How can I do it?
In [dspace-install-dir]/config/spring/api/discovery.xml, you can add your custom search filter. For example, if you want to add a search filter for dc.type, you should add:
<bean id="searchFilterType" class="org.dspace.discovery.configuration.DiscoverySearchFilterFacet">
<property name="indexFieldName" value="type"/>
<property name="metadataFields">
<list>
<value>dc.type</value>
</list>
</property>
<property name="type" value="text"/>
<property name="sortOrder" value="VALUE"/>
</bean>
and then add:
<ref bean="searchFilterType" />
to the existing searchFilters, e.g.:
<list>
<ref bean="searchFilterTitle" />
<ref bean="searchFilterAuthor" />
<ref bean="searchFilterSubject" />
<ref bean="searchFilterIssued" />
<ref bean="searchFilterType" />
</list>
Make sure to add this in the
<bean id="homepageConfiguration" class="org.dspace.discovery.configuration.DiscoveryConfiguration" scope="prototype">
if you have this entry
<entry key="site" value-ref="homepageConfiguration" />
in your
<bean id="org.dspace.discovery.configuration.DiscoveryConfigurationService" class="org.dspace.discovery.configuration.DiscoveryConfigurationService">
After modifying sidebarFacets and searchFilters, don't forget to reindex existing items by running [dspace]/bin/dspace index-discovery -b, otherwise the changes will not appear.
Please read Search filters & sidebar facets Customization in the documentation for additional details.
UPDATE
To apply your own label for the searchFilters, edit your [dspace-install-dir]/webapps/xmlui/i18n/messages.xml
.
Example:
<message key="xmlui.ArtifactBrowser.SimpleSearch.filter.type">Type</message>
Please note that to ensure that your custom messages are not overwritten the next time you rebuild, you should store & manage it in your src tree:
[dspace-source]/dspace/modules/xmlui/src/main/webapp/i18n/
which is mentioned here.