solrdspace

DSpace 7 - No suggestions when adding a new metadata field to an existing item


In DSpace 7.4, while adding new metadata to an existing item I'm not getting any suggestions in the input box, is there any configuration step I'm missing?

I can see it working in the official demo site here

I see in dspace.log that there is this API call when I type something in the input box:

GET /server/api/core/metadatafields/search/byFieldName 

so I tried this with no results: /server/#api/core/metadatafields/search/byFieldName?query=author The same API call in the DSpace 7 demo site returns 3 results: https://api7.dspace.org/server/#api/core/metadatafields/search/byFieldName?query=author

Also, in solr.log I see this call, which returns no hits:

2023-01-11 13:09:55.709 INFO (qtp359742806-22) [ x:search] o.a.s.c.S.Request [search] webapp=/solr path=/select params={q=*:*&fl=search.resourcetype,search.resourceid,search.uniqueid,database_status&start=0&fq=fieldName_keyword:author*&fq=&wt=javabin&version=2} hits=0 status=0 QTime=1

Maybe there is a problem with SOLR?


Solution

  • Since it seemed to be a SOLR problem, I tried to reindex like this: dspace index-discovery -b, thus getting this error:

    java.lang.NullPointerException: Cannot invoke "org.dspace.eperson.EPerson.getID()" because the return value of "org.dspace.authorize.ResourcePolicy.getEPerson()" is null
            at org.dspace.discovery.SolrServiceResourceRestrictionPlugin.additionalIndex(SolrServiceResourceRestrictionPlugin.java:95)
            at org.dspace.discovery.indexobject.IndexFactoryImpl.buildDocument(IndexFactoryImpl.java:67)
            at org.dspace.discovery.indexobject.InprogressSubmissionIndexFactoryImpl.buildDocument(InprogressSubmissionIndexFactoryImpl.java:46)
            at org.dspace.discovery.indexobject.WorkspaceItemIndexFactoryImpl.buildDocument(WorkspaceItemIndexFactoryImpl.java:63)
            at org.dspace.discovery.indexobject.WorkspaceItemIndexFactoryImpl.buildDocument(WorkspaceItemIndexFactoryImpl.java:30)
            at org.dspace.discovery.SolrServiceImpl.update(SolrServiceImpl.java:165)
            at org.dspace.discovery.SolrServiceImpl.indexContent(SolrServiceImpl.java:155)
            at org.dspace.discovery.SolrServiceImpl.updateIndex(SolrServiceImpl.java:340)
            at org.dspace.discovery.SolrServiceImpl.updateIndex(SolrServiceImpl.java:327)
            at org.dspace.discovery.IndexClient.internalRun(IndexClient.java:130)
            at org.dspace.scripts.DSpaceRunnable.run(DSpaceRunnable.java:104)
            at org.dspace.app.launcher.ScriptLauncher.executeScript(ScriptLauncher.java:149)
            at org.dspace.app.launcher.ScriptLauncher.handleScript(ScriptLauncher.java:131)
            at org.dspace.app.launcher.ScriptLauncher.main(ScriptLauncher.java:98)
    

    And found the solution here: https://groups.google.com/g/dspace-tech/c/ioukme4el9o.

    WARNING: It's recommended to test this in a development environment first.

    The problem is that there was several rows with no eperson_id and no epersongroup_id in the resourcepolicy table. So, I've deleted those rows with delete from resourcepolicy where eperson_id is null and epersongroup_id is null; and reindexed: dspace index-discovery -b.

    Note: this problem seems to occur whenever the database comes from a dump of a previous DSpace version. In my case I restored a dump from a 5.6 version and migrated it to 7.4 before running into this issue.