想要在 dspace 4.x 搜索过滤器方面添加自定义过滤器类型
Want to add custom filter type in dspace 4.x search filter facet
我使用的是 dspace 4.x XMLUI 版本。我想添加新的过滤器类型,如 "Type of Learning Material"、"Education Level" 等。在发现搜索过滤器列表中(不在侧边栏方面)。我该怎么做?
在 [dspace-install-dir]/config/spring/api/discovery.xml 中,您可以添加自定义搜索过滤器。例如,如果要为 dc.type 添加搜索过滤器,则应添加:
<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>
然后添加:
<ref bean="searchFilterType" />
到现有的搜索过滤器,例如:
<list>
<ref bean="searchFilterTitle" />
<ref bean="searchFilterAuthor" />
<ref bean="searchFilterSubject" />
<ref bean="searchFilterIssued" />
<ref bean="searchFilterType" />
</list>
确保将此添加到
<bean id="homepageConfiguration" class="org.dspace.discovery.configuration.DiscoveryConfiguration" scope="prototype">
如果你有这个条目
<entry key="site" value-ref="homepageConfiguration" />
在你的
<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.
请阅读文档中的 Search filters & sidebar facets Customization 了解更多详细信息。
更新
要为搜索过滤器应用您自己的标签,请编辑您的 [dspace-install-dir]/webapps/xmlui/i18n/messages.xml
。
示例:
<message key="xmlui.ArtifactBrowser.SimpleSearch.filter.type">Type</message>
请注意,为确保您的自定义消息在您下次重建时不被覆盖,您应该在您的 src 树中存储和管理它:
[dspace-source]/dspace/modules/xmlui/src/main/webapp/i18n/
提到 here.
我使用的是 dspace 4.x XMLUI 版本。我想添加新的过滤器类型,如 "Type of Learning Material"、"Education Level" 等。在发现搜索过滤器列表中(不在侧边栏方面)。我该怎么做?
在 [dspace-install-dir]/config/spring/api/discovery.xml 中,您可以添加自定义搜索过滤器。例如,如果要为 dc.type 添加搜索过滤器,则应添加:
<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>
然后添加:
<ref bean="searchFilterType" />
到现有的搜索过滤器,例如:
<list>
<ref bean="searchFilterTitle" />
<ref bean="searchFilterAuthor" />
<ref bean="searchFilterSubject" />
<ref bean="searchFilterIssued" />
<ref bean="searchFilterType" />
</list>
确保将此添加到
<bean id="homepageConfiguration" class="org.dspace.discovery.configuration.DiscoveryConfiguration" scope="prototype">
如果你有这个条目
<entry key="site" value-ref="homepageConfiguration" />
在你的
<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.
请阅读文档中的 Search filters & sidebar facets Customization 了解更多详细信息。
更新
要为搜索过滤器应用您自己的标签,请编辑您的 [dspace-install-dir]/webapps/xmlui/i18n/messages.xml
。
示例:
<message key="xmlui.ArtifactBrowser.SimpleSearch.filter.type">Type</message>
请注意,为确保您的自定义消息在您下次重建时不被覆盖,您应该在您的 src 树中存储和管理它:
[dspace-source]/dspace/modules/xmlui/src/main/webapp/i18n/
提到 here.