Introduction

Introduced in DSpace-CRIS 2021.02.00, the Lucky Search, as the name suggests, is a search functionality that works in a particular way: instead of displaying a full list of search results, it automatically redirects the user to a specific item when an exact match is found.

Configuration

In order to enable the lucky-search, we need to add it as a DiscoveryConfiguration bean

<bean id="lucky" class="org.dspace.discovery.configuration.DiscoveryConfiguration"> <property name="indexAlways" value="true"/> <!-- filter queries for lucky configuration--> <property name="defaultFilterQueries"> <list> <value>search.resourcetype:Item</value> </list> </property> <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="sortFields"> <list> <ref bean="sortTitleAsc"/> </list> </property> </bean> </property> <!-- empty list of facets--> <property name="sidebarFacets"> <list> </list> </property> <property name="searchFilters"> <list> <ref bean="searchFilterOrcid"/> <ref bean="searchFilterDoi"/> <ref bean="searchFilterLegacyId"/> </list> </property> </bean>


and assign it to the DiscoveryConfigurationService map inside discovery.xml file, as any other search configuration.

<bean id="org.dspace.discovery.configuration.DiscoveryConfigurationService" class="org.dspace.discovery.configuration.DiscoveryConfigurationService"> <property name="map"> <map> ..... ..... ..... <entry key="lucky-search" value-ref="lucky"/> ..... </map> </property> .....


Usage

In order to use this functionality we need to make a request to the /lucky-search endpoint and specify two query parameters:

  • index, the unique identifier type that has to be used for the lookup process

  • value, the value itself

Example: https://[dspace-cris instance domain]/lucky-search?index=doi&value=10.1617%2Fs11527-229-9527-6

Based on the default configuration that we can see in the previous section, especially the searchFilters property, we could use three types of identifier:

  • orcid, based on person.identifier.orcid

  • doi, based on dc.identifier.doi

  • legacy-id, based on cris.legacyId

    • This is useful to search items based on their old CRIS 5 identifier

Enhancements

Starting from DSpace-CRIS 2023.02.01, Lucky Search has been improved to also support direct redirection to bitstreams.

To support this behavior, two new query parameters have been added:

  • bitstreamMetadata: the metadatum that is needed to uniquely identify the bitstream

  • bitstreamValue: the value itself

Example: https://[dspace-cris instance domain]/lucky-search?index=doi&value=10.1617%2Fs11527-229-9527-6&bitstreamMetadata=dc.title&bitstreamValue=test.pdf

  • No labels