Future Release

This documentation covers the future release of VIVO, version 1.16.x which is currently in the process of testing.
If you are able to help contribute to this documentation, please contact vivo at lyrasis dot org
Looking for another version? See all documentation.

Introduction

The search page can be customized in terms of filters and sort options. For the purpose of customizing search page an ontology has been defined. How the default configuration looks like can be seen at Using Search.  

Ontology

Search configuration could be customized by using Vitro search ontology https://github.com/vivo-project/Vitro/blob/main/home/src/main/resources/rdf/tbox/filegraph/search_ontology.n3

Default search configuration for Vitro https://github.com/vivo-project/Vitro/blob/main/home/src/main/resources/rdf/display/firsttime/search_individuals_vitro.n3

Default search configuration for VIVO https://github.com/vivo-project/VIVO/blob/main/home/src/main/resources/rdf/display/firsttime/search_individuals_vivo.n3

Filters

An example of configuration search page filters is provided below. It includes one filter group with four filters. The first filter is range filter and enables filtering by start and end date. The second and third filters enable filtering by organizations and persons, respectively. The last one is filter which enables selection of publication years. The first filter is not public, therefore it wouldn't be seen by visitors, i.e. not logged in users. The listed configuration is default one present in the VIVO codebase by default, and it can be customized for the specific need of a VIVO instance. Moreover, there are also a couple more filters defined in the Vitro codebase by default. 

@prefix :      <https://vivoweb.org/ontology/vitro-search-individual/> .
@prefix vitro-search: <https://vivoweb.org/ontology/vitro-search#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .

:filter_group_search_filters  a    vitro-search:FilterGroup ;
        vitro-search:contains      :filter_dates , :filter_organizations , :filter_persons , :filter_publication_year .

:filter_dates  a            vitro-search:RangeFilter ;
        vitro-search:id           "dates" ;
		vitro-search:filterField  :field_dates ;
        vitro-search:from         "1900" ;
        vitro-search:to           "2030" ; 
        vitro-search:public       false .

:field_dates  a                    vitro-search:SearchField ;
        vitro-search:indexField    "dates_drsim" .

:filter_organizations  a           vitro-search:Filter ;
        vitro-search:id            "organizations" ;
        vitro-search:filterField   :field_organizations ;
        vitro-search:facetResults  true ;
		vitro-search:isUriValues   true ;
        vitro-search:public        true .

:field_organizations  a            vitro-search:SearchField ;
        vitro-search:indexField    "organizations_ss" ;
        vitro-search:multivalued   true .

:filter_persons  a                 vitro-search:Filter ;
        vitro-search:id            "persons" ;
        vitro-search:filterField   :field_persons ;
        vitro-search:facetResults  true ;
        vitro-search:isUriValues   true ;
        vitro-search:public        true .

:field_persons  a                  vitro-search:SearchField ;
        vitro-search:indexField   "persons_ss" ;
        vitro-search:isLanguageSpecific true ;
        vitro-search:multivalued  true .

:filter_publication_year  a        vitro-search:Filter ;
        vitro-search:id            "publication_year" ;
        vitro-search:filterField   :field_publication_year ;
        vitro-search:facetResults  true ;
        vitro-search:public        true .

:field_publication_year  a         vitro-search:SearchField ;
        vitro-search:indexField    "publication_year_ss" .

How to create a group of filters

To create new filter group one has to create an individual with a class vitro-search:FilterGroup

Each filter group should have a unique identifier set by using vitro-search:id data property.

Filters could be assign to a Filter group by using vitro-search:contains object property.

Order of filter group in the list is defined by vitro-search:order data property.

How to create a search filter

Each filter should be represented by instance of class vitro-search:Filter.

Filter also should have unique identifier set by vitro-search:id data property.

Filter is linked to the Search field by using vitro-search:filterField object property.

Filter field should be an instance of vitro-search:SearchField class and index field name assigned with vitro-search:indexField property.


Role based search filtering

Besides defining whether some field is public or not, the VIVO customers can define SelectQueryDocumentModifier for filters which can include typeRestrictions and selectQuery. In this way some restrictions for searching can be defined. Moreover, it is possible to define role-based search results filtering. For instance, it is possible that only a certain type of results can be displayed for a certain role. The listing below presents configuration which is showing only instances of Continent class for public, admin and self-editor. 

@prefix :      <https://vivoweb.org/ontology/vitro-search-individual/> .
@prefix vitro-search: <https://vivoweb.org/ontology/vitro-search#> .
@prefix auth: <http://vitro.mannlib.cornell.edu/ns/vitro/authorization#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

:locations_value
        a                        vitro-search:FilterValue ;
        rdfs:label               "Continent"@en-US ;
        vitro-search:id          "http://vivoweb.org/ontology/core#Continent" ;
        vitro-search:public      true ;
        vitro-search:isDefaultForRole  auth:SELF_EDITOR , auth:ADMIN , auth:PUBLIC .

:filter_type vitro-search:hasKnownValue :locations_value .


Sorting

The options for sorting search results can be also customized. The default configuration enables sorting by title ascending, by title descending, and by relevance. However, it is possible to extend list of fields for sorting. For instance, sorting by dates can be added. 

@prefix :      <https://vivoweb.org/ontology/vitro-search-individual/> .
@prefix vitro-search: <https://vivoweb.org/ontology/vitro-search#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .


:sort_title_desc  a                vitro-search:Sort ;
        vitro-search:isAscending   false ;
        vitro-search:hasFallback   :sort_name_raw_desc ;
        vitro-search:order         30 ;
        vitro-search:sortField     :field_label_sort ;
        vitro-search:display       true ;
        vitro-search:id            "titledesc" .

:sort_title_asc  a                 vitro-search:Sort ;
        vitro-search:isAscending   true ;
        vitro-search:hasFallback   :sort_name_raw_asc ;
        vitro-search:order         20 ;
        vitro-search:sortField     :field_label_sort ;
        vitro-search:display       true ;
        vitro-search:id            "titleasc" .

:sort_name_raw_desc  a             vitro-search:Sort ;
        vitro-search:isAscending   false ;
        vitro-search:order         50 ;
        vitro-search:sortField     :field_name_raw ;
        vitro-search:id            "name_raw_desc" .

:sort_name_raw_asc  a                vitro-search:Sort ;
        vitro-search:isAscending   true ;
        vitro-search:order         40 ;
        vitro-search:sortField     :field_name_raw ;
        vitro-search:id            "name_raw_asc" .

:sort_by_relevance a                vitro-search:Sort ;
        vitro-search:sortField     :field_score ;
        vitro-search:display       true ;
        vitro-search:order         60 ;
        vitro-search:id            "relevance" .

:field_score
        a                          vitro-search:SearchField ;
        vitro-search:indexField    "score" .

:field_label_sort
        a                          vitro-search:SearchField ;
        vitro-search:isLanguageSpecific true ;
        vitro-search:indexField    "_label_sort" .

:field_name_raw
        a                          vitro-search:SearchField ;
        vitro-search:indexField    "nameRaw" .




  • No labels