Skip to content

VIVO-1694 Faceted browsing in browse and search page - Cineca custom

backups requested to merge github/fork/alessandroGalasso/VIVO-1694 into main

Created by: alessandroGalasso

JIRA Issue: https://jira.duraspace.org/browse/VIVO-1694

What does this pull request do?

New document modifier "JsonFacetsModifier" The Document modifier will create new fields searching for the properties described in the "config.json" file; starting from the Individual Object and going as deep into the data model as the recursive json config demands.

recoursive approach example:

    {    
        "solr":"authorContinent",
        "qualifiedByDomain": "http://purl.org/ontology/bibo/Document",
        "configContextFor": "http://vivoweb.org/ontology/core#relatedBy",
        "qualifiedBy": "http://vivoweb.org/ontology/core#Authorship",
            "pivotsIndexProperty":{
                "configContextFor": "http://vivoweb.org/ontology/core#relates",
                "qualifiedBy": "http://xmlns.com/foaf/0.1/Person",
                    "pivotsIndexProperty":{
                         "configContextFor": "http://vivoweb.org/ontology/core#geographicFocus",
                         "qualifiedBy": "http://vivoweb.org/ontology/core#Country",
                              "pivotsIndexProperty":{
                                  "configContextFor": "http://aims.fao.org/aos/geopolitical.owl#isInGroup",
                                  "qualifiedBy": "http://vivoweb.org/ontology/core#Continent",
                                       "pivotsIndexProperty":{
                                            "configContextFor": "http://www.w3.org/2000/01/rdf-schema#label",
                                        }
                              }
                     },
            },        
    },

It is also possible to apply a regexp on the literal value: regexp example:

    {
        "solr":"articleYear",
        "qualifiedByDomain": "http://purl.org/ontology/bibo/AcademicArticle",
        "configContextFor": "http://vivoweb.org/ontology/core#dateTimeValue",
        "qualifiedBy": "http://vivoweb.org/ontology/core#DateTimeValue",
            "pivotsIndexProperty":{
             "configContextFor": "http://vivoweb.org/ontology/core#dateTime",
             "regexp":"^([0-9]{4,4})-.*$",
             "regexpreplace":"$1",
            },
    },

The new fields on the search server:
"_facets" , "_facetsOrder" , "_facetsCount" , "_uri_facets"

We use these fields in our custom instance for the following improvements:

  1. better performance and detalied infos on result lists (fetching data from solr into the browse and search templates) example:
    "Article Name(j)" , < a "author link(i)" >Author(i) </ a> "Department Name(x)" - number of related Individuals

  2. Customized browsing order based on configuration and "*_facetsOrder" fields example: Browse "Research" by "publication date"

  3. facets with pivot faceting query based on json configuration and "*_facets" fields example:
    ...&facet=true&facet.pivot=type,freetextKeyword_facets...

  4. overrides on edismax qf to boost search results on "*_facets" fields example:
    .. &qf=freetextKeyword_facets^5...

How should this be tested?

To install the document modifier on your existing VIVO instance:

  • create a json folder in the install dir and copy the config.json configuration file inside. example:
    home\rdf
    home\json\config.json
  • update the \solr\conf\schema.xml configuration with the new dynamic Fields
  • maven update

Example:

To test this "config.json" demo file you should have at least an Academic Article with 1 or more author (with a Geographic Focus Country) , a publication date and a status.

Force the update on the SOLR Server, log in and edit the Academic Article title.

Open the solr console and search for the modified document, you should see something like this: Modified Article document - example:

"author_uri_facets":["http://irises.unimi.it/individual/n3196"], "author_facets":["auth name"], "author_facetsCount":1, "author_facetsOrder":"auth name",

"authorContinent_uri_facets":["http://aims.fao.org/aos/geopolitical.owl#Europe"], "authorContinent_facets":["Europe"], "authorContinent_facetsCount":1, "authorContinent_facetsOrder": "Europe"

"withStatus_facetsOrder": "accepted", "withStatus_facets": [ "accepted" ], "withStatus_facetsCount": 1, "withStatus_uri_facets": [ "http://purl.org/ontology/bibo/accepted" ]

"articleYear_uri_facets": [ "http://irises.unimi.it/individual/n3966" ], "articleYear_facets": [ "2025" ], "articleYear_facetsOrder": "2025", "articleYear_facetsCount": 1

Interested parties

@VIVO-project/vivo-committers

Merge request reports