Search code examples
xsltdspace

Over-riding DRI Templates using xsl in DSpace


I'm working with DSpace 4.2 xmlui Mirage theme. I want to hide the Communities and Collections from the search results page.

enter image description here

By inspecting the DRI document of the page I found that the Communities and Collections results are added as:

<list id="aspect.discovery.SimpleSearch.list.comm-coll-result-list" n="comm-coll-result-list">

So I tried over-riding the template in the xsl file of the theme.

<xsl:template match="dri:list[@id='aspect.discovery.SimpleSearch.list.comm-coll-result-list']">
<!-- Over ride / remove the recent submissions box-->
</xsl:template>

But no change is reflected in the page. Am I doing something wrong here? I was able to hide the default search box in a similar manner by over-riding the template generating it's corresponding div.I noticed that the list item I want to hide is contained within another div. Is is not possible to over-ride a DRI element unless its tag is div?


Solution

  • You can also add a default filter query in your [dspace]/config/spring/api/discovery.xml.

    Default filter queries are applied on all search operations & sidebarfacet clicks. One useful application of default filter queries is ensuring that all returned results are items. As a result, subcommunities and collections that are returned as results of the search operation, are filtered out.

    Relevant lines here, note that this is disabled by default. Uncomment to make this work.

    <property name="defaultFilterQueries">
    <list>
        <value>search.resourcetype:2</value>
    </list>
    

    Hope this help.

    UPDATE

    Copy the:

    <property name="defaultFilterQueries">
        <list>
          <value>search.resourcetype:2</value>
        </list>
    <property>
    

    in the <bean id="homepageConfiguration" class="org.dspace.discovery.configuration.DiscoveryConfiguration" scope="prototype"> because it overrides the defaultConfiguration as stated in this comment.