dspace

How to modify search fields on xmlui


Im new to Dspace. Im using the XMLUI interface, and the version 6.3 I want to modify the search fields, and the instructions from the wiki (https://wiki.lyrasis.org/display/DSPACE/Modify+search+fields) says that I sould look for this line in dspace.cfg: ##### Fields to Index for Search #####

But in the dspace.cfg document, that line is only under the JSPUI specific configurations

    ### 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

Does anyone knows how I can change the search fields in the xmlui interface? I don't know if I'm looking in the wrong file because I'm a begginer, but I can't find any other dspace.cfg document, and neither can I find a dspace.src document. Thanks in advance


Solution

  • I think what you're looking for is the discovery search filters. You can add metadata fields that you would like to be 'searchable' aside from the default fields. Please see the documentation for discovery: Configuring lists of sidebarFacets and searchFilters

    The file to edit can be found in [dspace]/config/spring/api/discovery.xml.

    For example, I created a new search filter for document types.

        <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>
    

    Then I reference it in the defaultConfiguration bean to appear in sidebar facets and search filters. Please note that all sidebar facets should also have a search filter as per the documentation:

    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>
    

    Lastly, you should also update the search filters and sidebar facets in the homepageConfiguration bean if you want your new sidebar facets to appear in the home page. Don't forget to restart DSpace (stop and start Tomcat) and run dspace index-discovery -b every time you modified discovery.xml.