ncbo / ontologies_api

Hypermedia API for NCBO's ontology-related projects
http://data.bioontology.org
Other
25 stars 10 forks source link

Search test 'test_search_other_filters' fails on a test ontology #34

Closed mdorf closed 7 years ago

mdorf commented 7 years ago

The test test_search_other_filters suddenly started failing on line 106:

https://github.com/ncbo/ontologies_api/blob/staging/test/controllers/test_search_controller.rb#L106

The test fails because it returns 27 records instead of the expected 26. The extra record contains an empty definition:

{
  "resource_id": "http://bioontology.org/ontologies/BiomedicalResourceOntology.owl#Volume_Model_Scene_Data",
  "ontologyId": [
    "http://data.bioontology.org/ontologies/BROSEARCHTEST-0/submissions/1"
  ],
  "submissionAcronym": "BROSEARCHTEST-0",
  "submissionId": 1,
  "ontologyType": "VALUE_SET_COLLECTION",
  "obsolete": false,
  "childCount": 0,
  "id": "http://bioontology.org/ontologies/BiomedicalResourceOntology.owl#Volume_Model_Scene_Data_BROSEARCHTEST-0_1",
  "prefLabel": "Volume Model Scene Data",
  "prefLabelExact": "Volume Model Scene Data",
  "prefLabelSuggest": "Volume Model Scene Data",
  "prefLabelSuggestEdge": "Volume Model Scene Data",
  "prefLabelSuggestNgram": "Volume Model Scene Data",
  "definition": [
    ""
  ],
  "property": [
    "BRO:Volume_Model_Scene_Data",
    "",
    "pending final vetting: provide definition",
    "Volume Model Scene Data",
    "http://www.w3.org/2002/07/owl#Class",
    "http://bioontology.org/ontologies/BiomedicalResourceOntology.owl#Computational_Model"
  ],
  "propertyRaw": "{\"http://data.bioontology.org/metadata/prefixIRI\":[\"BRO:Volume_Model_Scene_Data\"],\"http://bioontology.org/ontologies/biositemap.owl#definition\":[\"\"],\"http://www.w3.org/2004/02/skos/core#editorialNote\":[\"pending final vetting: provide definition\"],\"http://www.w3.org/2004/02/skos/core#prefLabel\":[\"Volume Model Scene Data\"],\"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\":[\"http://www.w3.org/2002/07/owl#Class\"],\"http://www.w3.org/2000/01/rdf-schema#subClassOf\":[\"http://bioontology.org/ontologies/BiomedicalResourceOntology.owl#Computational_Model\"]}",
  "_version_": 1566306957107658800,
  "provisional": false
}

I've patched the code on the search side to ignore empty elements inside arrays when indexing, but the circumstances remain suspicious, since the test ontology itself has not changed, and neither did the original test.

mdorf commented 7 years ago

misha [11:37 AM] ok, I’ve spent some more time digging into this because it deeply troubled me having unexpected failures in tests whose code should not’ve been affected

[11:37] I believe the problem is in the solr API that we’re using.

[11:38] The rsolr module got upgraded from 1.1.2 to 2.0.0

[11:39] and it looks like it changed the behavior of empty array values

[11:40] in 1.1.2, when you send in an array that looks like [“”], the value is being ignored

[11:40] in 2.0.0. that safety check no longer appears to be in place, and the array is treated as “non-empty”

[11:41] the code that I added to the indexing module will handle this case, so I think all is well with this case