ec-jrc / re3gistry

Re3gistry is a reusable open source solution for managing and sharing ‘reference codes’, ensuring semantic interoperability across organisations.
European Union Public License 1.2
29 stars 21 forks source link

Wrong values in status dropdown in Search options public front-end web app #111

Closed heidivanparys closed 2 years ago

heidivanparys commented 2 years ago

The dropdown for status values, in the search options in the public front-end web app, shows wrong values. Apart from “valid” and “retired”, which is correct, it also shows the IP address, “http” and “registry”, which is wrong.

image

The parameters sent to the Solr API (when entering value “item” in the search box on the front page) are

q=fl_label_en%3A(item*)%5E3.0%20OR%20fl_definition_en%3A(item*)%5E1.0
start=0
rows=10
wt=json
facet=true
json.facet=%7B%22register_itemclass_localid%22%3A%7B%22type%22%3A%22terms%22%2C%22field%22%3A%22register_itemclass_localid%22%2C%22limit%22%3A-1%7D%2C%22status_uri%22%3A%7B%22type%22%3A%22terms%22%2C%22field%22%3A%22status_uri%22%2C%22limit%22%3A-1%7D%7D

The interesting part of the response of Solr is the facets property, which apparently is used to populate the dropdown, see https://github.com/ec-jrc/re3gistry/blob/14b1d84135ae8000200bd16e5388fab59c3859a0/dist/webapp/public_html/js/app_core_search.js#L394-L424

That seems to be a mistake. I would expect a dropdown with values "valid" and "retired", or a dropdown with the full URIs of those values. A guess is that Solr responds with what it has, but that status URIs for some reason are indexed in a wrong way in Solr?

"facets":{
    "count":4,
    "register_itemclass_localid":{
      "buckets":[{
          "val":"registertilformattests",
          "count":4}]},
    "status_uri":{
      "buckets":[{
          "val":"hidden_ip_address",
          "count":4},
        {
          "val":"http",
          "count":4},
        {
          "val":"registry",
          "count":4},
        {
          "val":"valid",
          "count":3},
        {
          "val":"retired",
          "count":1}]}}

The complete response:

{
  "responseHeader":{
    "status":0,
    "QTime":1,
    "params":{
      "q":"fl_label_en:(item*)^3.0 OR fl_definition_en:(item*)^1.0",
      "json.facet":"{\"register_itemclass_localid\":{\"type\":\"terms\",\"field\":\"register_itemclass_localid\",\"limit\":-1},\"status_uri\":{\"type\":\"terms\",\"field\":\"status_uri\",\"limit\":-1}}",
      "start":"0",
      "rows":"10",
      "wt":"json",
      "facet":"true"}},
  "response":{"numFound":4,"start":0,"numFoundExact":true,"docs":[
      {
        "id":"7719780450e10524d63b973808b4c07d",
        "localid":["2"],
        "master_language":["da"],
        "external":[false],
        "currentversion":[0],
        "insertdate":["2021-12-06T10:01:08.113Z"],
        "itemclass_localid":["registerTilFormatTests-item"],
        "itemclass_type":["item"],
        "parent_itemclass_localid":["registerTilFormatTests"],
        "parent_itemclass_type":["register"],
        "status_uri":["http://hidden_ip_address/registry/valid"],
        "registry_itemclass_baseuri":["http://hidden_ip_address"],
        "registry_itemclass_localid":["registry"],
        "registry_localid":["registry"],
        "register_itemclass_baseuri":["http://hidden_ip_address"],
        "register_itemclass_localid":["registerTilFormatTests"],
        "register_localid":["registerTilFormatTests"],
        "uri":["http://hidden_ip_address/registerTilFormatTests/2"],
        "fl_label_da":["2��� ��� �����"],
        "fl_label_en":["2"],
        "fl_definition_da":["<p>item 2 æøå ÆØÅ</p>"],
        "fl_definition_en":["<p>item two</p>"],
        "_version_":1718391088357572608},
      {
        "id":"4db19d0300a2972c26ca76dec4f1655f",
        "localid":["1"],
        "master_language":["da"],
        "external":[false],
        "currentversion":[0],
        "insertdate":["2021-12-06T10:07:46.708Z"],
        "itemclass_localid":["registerTilFormatTests-item"],
        "itemclass_type":["item"],
        "parent_itemclass_localid":["registerTilFormatTests"],
        "parent_itemclass_type":["register"],
        "status_uri":["http://hidden_ip_address/registry/retired"],
        "registry_itemclass_baseuri":["http://hidden_ip_address"],
        "registry_itemclass_localid":["registry"],
        "registry_localid":["registry"],
        "register_itemclass_baseuri":["http://hidden_ip_address"],
        "register_itemclass_localid":["registerTilFormatTests"],
        "register_localid":["registerTilFormatTests"],
        "uri":["http://hidden_ip_address/registerTilFormatTests/1"],
        "fl_label_da":["1"],
        "fl_label_en":["1"],
        "fl_definition_da":["<p>item 1</p>"],
        "fl_definition_en":["<p>English definition item 1</p>"],
        "_version_":1718391088610279424},
      {
        "id":"16fb47a2778cd4cffab5c55278a08093",
        "localid":["3"],
        "master_language":["da"],
        "external":[false],
        "currentversion":[0],
        "insertdate":["2021-12-06T10:01:07.263Z"],
        "itemclass_localid":["registerTilFormatTests-item"],
        "itemclass_type":["item"],
        "parent_itemclass_localid":["registerTilFormatTests"],
        "parent_itemclass_type":["register"],
        "status_uri":["http://hidden_ip_address/registry/valid"],
        "registry_itemclass_baseuri":["http://hidden_ip_address"],
        "registry_itemclass_localid":["registry"],
        "registry_localid":["registry"],
        "register_itemclass_baseuri":["http://hidden_ip_address"],
        "register_itemclass_localid":["registerTilFormatTests"],
        "register_localid":["registerTilFormatTests"],
        "uri":["http://hidden_ip_address/registerTilFormatTests/3"],
        "fl_label_da":["3"],
        "fl_label_en":["3"],
        "fl_definition_da":["<p>item 3</p>"],
        "fl_definition_en":["<p>item three</p>"],
        "_version_":1718391088849354752},
      {
        "id":"af017aba83f124fca00f832f604d08ee",
        "localid":["4"],
        "master_language":["da"],
        "external":[false],
        "currentversion":[0],
        "insertdate":["2021-12-06T10:01:08.484Z"],
        "itemclass_localid":["registerTilFormatTests-item"],
        "itemclass_type":["item"],
        "parent_itemclass_localid":["registerTilFormatTests"],
        "parent_itemclass_type":["register"],
        "status_uri":["http://hidden_ip_address/registry/valid"],
        "registry_itemclass_baseuri":["http://hidden_ip_address"],
        "registry_itemclass_localid":["registry"],
        "registry_localid":["registry"],
        "register_itemclass_baseuri":["http://hidden_ip_address"],
        "register_itemclass_localid":["registerTilFormatTests"],
        "register_localid":["registerTilFormatTests"],
        "uri":["http://hidden_ip_address/registerTilFormatTests/4"],
        "fl_label_en":["4"],
        "fl_label_da":["4"],
        "fl_definition_en":["<p>item four</p>"],
        "fl_definition_da":["<p>Item 4 update</p>"],
        "_version_":1718391089094721536}]
  },
  "facet_counts":{
    "facet_queries":{},
    "facet_fields":{},
    "facet_ranges":{},
    "facet_intervals":{},
    "facet_heatmaps":{}},
  "facets":{
    "count":4,
    "register_itemclass_localid":{
      "buckets":[{
          "val":"registertilformattests",
          "count":4}]},
    "status_uri":{
      "buckets":[{
          "val":"hidden_ip_address",
          "count":4},
        {
          "val":"http",
          "count":4},
        {
          "val":"registry",
          "count":4},
        {
          "val":"valid",
          "count":3},
        {
          "val":"retired",
          "count":1}]}}}
emanuelaepure10 commented 2 years ago

Hello @heidivanparys

The line 374 from https://github.com/ec-jrc/re3gistry/blob/master/sources/Re3gistry2JavaAPI/src/main/java/eu/europa/ec/re3gistry2/javaapi/solr/SolrHandler.java solve this problem. After update/change please clean Solr and reindex the data.

Let me know if it does in you case as well.

Best regards

heidivanparys commented 2 years ago

Thanks for looking at this. We closed the proof-of-concept we were running last year, so I cannot test this any more, I'm afraid.

emanuelaepure10 commented 2 years ago

I will close it as it should be solved with the latest updated.