如何在xmlui上修改搜索字段

How to modify search fields on xmlui

我是 Dspace 的新手。我使用的是 XMLUI 界面和 6.3 版 我想修改搜索字段,wiki (https://wiki.lyrasis.org/display/DSPACE/Modify+search+fields) 中的说明说我应该在 dspace.cfg 中查找这一行:##### Fields to Index for Search #### #

但在dspace.cfg文档中,该行仅在JSPUI特定配置下

    ### Configure the search indices to appear in advanced search drop down lists
#
jspui.search.index.display.1 = ANY
jspui.search.index.display.2 = author
jspui.search.index.display.3 = title
jspui.search.index.display.4 = keyword
jspui.search.index.display.5 = abstract
jspui.search.index.display.6 = series
jspui.search.index.display.7 = sponsor
jspui.search.index.display.8 = identifier
jspui.search.index.display.9 = language

有谁知道如何更改 xmlui 界面中的搜索字段? 我不知道我是不是找错了文件,因为我是初学者,但我找不到任何其他 dspace.cfg 文件,我也找不到 dspace.src 文件。提前致谢

我认为您正在寻找的是发现搜索过滤器。除了默认字段之外,您还可以添加希望 'searchable' 的元数据字段。发现请看文档:Configuring lists of sidebarFacets and searchFilters

可以在 [dspace]/config/spring/api/discovery.xml 中找到要编辑的文件。

例如,我为文档类型创建了一个新的搜索过滤器。

    <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="sortOrderSidebar" value="COUNT"/>
        <property name="sortOrderFilterPage" value="VALUE"/>
    </bean>

然后我在 defaultConfiguration bean 中引用它以显示在侧边栏方面和搜索过滤器中。请注意,根据文档,所有侧边栏方面还应具有搜索过滤器:

Each sidebar facet must also occur in the list of the search filters.

    <!--The default configuration settings for discovery-->
    <bean id="defaultConfiguration" class="org.dspace.discovery.configuration.DiscoveryConfiguration" scope="prototype">
        <!--Which sidebar facets are to be displayed-->
        <property name="sidebarFacets">
            <list>
                <ref bean="searchFilterAuthor" />
                <ref bean="searchFilterSubject" />
                <ref bean="searchFilterIssued" />
                <ref bean="searchFilterType" />
                <ref bean="searchFilterContentInOriginalBundle"/>
            </list>
        </property>
        <!-- Set TagCloud configuration per discovery configuration -->
        <property name="tagCloudFacetConfiguration" ref="defaultTagCloudFacetConfiguration"/>
        <!--The search filters which can be used on the discovery search page-->
        <property name="searchFilters">
            <list>
                <ref bean="searchFilterTitle" />
                <ref bean="searchFilterAuthor" />
                <ref bean="searchFilterSubject" />
                <ref bean="searchFilterIssued" />
                <ref bean="searchFilterType" />
                <ref bean="searchFilterContentInOriginalBundle"/>
                <ref bean="searchFilterFileNameInOriginalBundle" />
                <ref bean="searchFilterFileDescriptionInOriginalBundle" />
            </list>
        </property>
        <!--The sort filters for the discovery search-->
        <property name="searchSortConfiguration">
            <bean class="org.dspace.discovery.configuration.DiscoverySortConfiguration">
                <!--<property name="defaultSort" ref="sortDateIssued"/>-->
                <!--DefaultSortOrder can either be desc or asc (desc is default)-->
                <property name="defaultSortOrder" value="desc"/>
                <property name="sortFields">
                    <list>
                        <ref bean="sortTitle" />
                        <ref bean="sortDateIssued" />
                    </list>
                </property>
            </bean>
        </property>
        <!--Any default filter queries, these filter queries will be used for all queries done by discovery for this configuration-->
        <!--<property name="defaultFilterQueries">-->
            <!--<list>-->
                <!--Only find items-->
                <!--<value>search.resourcetype:2</value>-->
            <!--</list>-->
        <!--</property>-->
        <property name="defaultFilterQueries">
        <list>
        <!--Only find items-->
        <value>search.resourcetype:2</value>
        </list>
        </property>
        <!--The configuration for the recent submissions-->
        <property name="recentSubmissionConfiguration">
            <bean class="org.dspace.discovery.configuration.DiscoveryRecentSubmissionsConfiguration">
                <property name="metadataSortField" value="dc.date.accessioned" />
                <property name="type" value="date"/>
                <property name="max" value="20"/>
                <!-- If enabled the collection home page will not display metadata but show a pageable list of recent submissions -->
                <property name="useAsHomePage" value="false"/>
            </bean>
        </property>
        <!--Default result per page  -->
        <property name="defaultRpp" value="10" />
        <property name="hitHighlightingConfiguration">
            <bean class="org.dspace.discovery.configuration.DiscoveryHitHighlightingConfiguration">
                <property name="metadataFields">
                    <list>
                        <bean class="org.dspace.discovery.configuration.DiscoveryHitHighlightFieldConfiguration">
                            <property name="field" value="dc.title"/>
                            <property name="snippets" value="5"/>
                        </bean>
                        <bean class="org.dspace.discovery.configuration.DiscoveryHitHighlightFieldConfiguration">
                            <property name="field" value="dc.contributor.author"/>
                            <property name="snippets" value="5"/>
                        </bean>
                        <bean class="org.dspace.discovery.configuration.DiscoveryHitHighlightFieldConfiguration">
                            <property name="field" value="dc.description.abstract"/>
                            <property name="maxSize" value="250"/>
                            <property name="snippets" value="2"/>
                        </bean>
                        <!-- By default, full text snippets are disabled, as snippets of embargoed/restricted bitstreams
                         may appear in search results when the Item is public. See DS-3498
                        <bean class="org.dspace.discovery.configuration.DiscoveryHitHighlightFieldConfiguration">
                            <property name="field" value="fulltext"/>
                            <property name="maxSize" value="250"/>
                            <property name="snippets" value="2"/>
                        </bean>
                        -->
                    </list>
                </property>
            </bean>
        </property>
        <property name="moreLikeThisConfiguration">
            <bean class="org.dspace.discovery.configuration.DiscoveryMoreLikeThisConfiguration">
                <!--When altering this list also alter the "xmlui.Discovery.RelatedItems.help" key as it describes
            the metadata fields below-->
                <property name="similarityMetadataFields">
                    <list>
                        <value>dc.title</value>
                        <value>dc.contributor.author</value>
                        <value>dc.creator</value>
                        <value>dc.subject</value>
                    </list>
                </property>
                <!--The minimum number of matching terms across the metadata fields above before an item is found as related -->
                <property name="minTermFrequency" value="5"/>
                <!--The maximum number of related items displayed-->
                <property name="max" value="3"/>
                <!--The minimum word length below which words will be ignored-->
                <property name="minWordLength" value="5"/>
            </bean>
        </property>
        <!-- When true a "did you mean" example will be displayed, value can be true or false -->
        <property name="spellCheckEnabled" value="true"/>
    </bean>

最后,如果您希望新的侧边栏 facet 出现在主页中,您还应该更新 homepageConfiguration bean 中的搜索过滤器和侧边栏 facet。每次修改discovery.xml.

不要忘记重启DSpace(停止并启动Tomcat)和运行dspace index-discovery -b