Skip to content

Commit

Permalink
Adds xref to searched fields, plus test (#681)
Browse files Browse the repository at this point in the history
Adds xref to searched fields, and an integration test to confirm it
  • Loading branch information
kevinschaper authored Apr 23, 2024
1 parent ac4e7b4 commit 5173608
Show file tree
Hide file tree
Showing 9 changed files with 199 additions and 198 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def entity_query_fields():
"""
Fields and boosts used for entity search, includes autocomplete fields and expands upon them beyond pure name fields
"""
return f"{autocomplete_query_fields()} description_t"
return f"{autocomplete_query_fields()} description_t xref"


def association_search_query_fields():
Expand Down
2 changes: 1 addition & 1 deletion backend/tests/fixtures/autocomplete_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def autocomplete_query():
"facet_fields": [],
"facet_queries": [],
"filter_queries": [],
"query_fields": "id^100 name^10 name_t^5 name_ac symbol^10 symbol_t^5 symbol_ac synonym synonym_t synonym_ac description_t",
"query_fields": "id^100 name^10 name_t^5 name_ac symbol^10 symbol_t^5 symbol_ac synonym synonym_t synonym_ac description_t xref",
"def_type": "edismax",
"q_op": "AND",
"mm": "100%",
Expand Down
4 changes: 2 additions & 2 deletions backend/tests/fixtures/autocomplete_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
def autocomplete_response():
return {
"responseHeader": {
"QTime": 1,
"QTime": 0,
"params": {
"mm": "100%",
"q": "fanc",
"defType": "edismax",
"facet_min_count": "1",
"qf": "id^100 name^10 name_t^5 name_ac symbol^10 symbol_t^5 symbol_ac synonym synonym_t synonym_ac description_t",
"qf": "id^100 name^10 name_t^5 name_ac symbol^10 symbol_t^5 symbol_ac synonym synonym_t synonym_ac description_t xref",
"start": "0",
"q.op": "AND",
"boost": 'product(if(termfreq(category,"biolink:PhenotypicFeature"),1.1,1),if(termfreq(category,"biolink:Disease"),1.3,1),if(and(termfreq(in_taxon,"NCBITaxon:9606"),termfreq(category,"biolink:Gene")),1.1,1),if(termfreq(deprecated,"true"),0.1,1))',
Expand Down
2 changes: 1 addition & 1 deletion backend/tests/fixtures/search_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def search_query():
"facet_fields": [],
"facet_queries": [],
"filter_queries": ["name:*"],
"query_fields": "id^100 name^10 name_t^5 name_ac symbol^10 symbol_t^5 symbol_ac synonym synonym_t synonym_ac description_t",
"query_fields": "id^100 name^10 name_t^5 name_ac symbol^10 symbol_t^5 symbol_ac synonym synonym_t synonym_ac description_t xref",
"def_type": "edismax",
"q_op": "AND",
"mm": "100%",
Expand Down
4 changes: 2 additions & 2 deletions backend/tests/fixtures/search_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
def search_response():
return {
"responseHeader": {
"QTime": 3,
"QTime": 2,
"params": {
"mm": "100%",
"q": "fanconi",
"defType": "edismax",
"facet_min_count": "1",
"qf": "id^100 name^10 name_t^5 name_ac symbol^10 symbol_t^5 symbol_ac synonym synonym_t synonym_ac description_t",
"qf": "id^100 name^10 name_t^5 name_ac symbol^10 symbol_t^5 symbol_ac synonym synonym_t synonym_ac description_t xref",
"start": "0",
"q.op": "AND",
"boost": 'product(if(termfreq(category,"biolink:PhenotypicFeature"),1.1,1),if(termfreq(category,"biolink:Disease"),1.3,1),if(and(termfreq(in_taxon,"NCBITaxon:9606"),termfreq(category,"biolink:Gene")),1.1,1),if(termfreq(deprecated,"true"),0.1,1))',
Expand Down
1 change: 1 addition & 0 deletions backend/tests/integration/test_solr_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# Failing because we don't have synonyms coming in from Phenio (!)
# "AD16",
"symphalangism, C. S. Lewis type",
"OMIM:301045", # Confirmation that we load & search xrefs for Mondo
],
)
def test_search_query_has_some_results(query: str):
Expand Down
18 changes: 9 additions & 9 deletions frontend/fixtures/phenotype-explorer-compare.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"subject_termset": {
"MP:0002169": {
"id": "MP:0002169",
"label": "no abnormal phenotype detected (MPO)"
},
"MP:0010771": {
"id": "MP:0010771",
"label": "integument phenotype (MPO)"
},
"MP:0002169": {
"id": "MP:0002169",
"label": "no abnormal phenotype detected (MPO)"
}
},
"object_termset": {
Expand Down Expand Up @@ -77,16 +77,16 @@
"HP:0004325": {
"match_source": "HP:0004325",
"match_source_label": "Decreased body weight (HPO)",
"match_target": "MP:0002169",
"match_target_label": "no abnormal phenotype detected (MPO)",
"match_target": "MP:0010771",
"match_target_label": "integument phenotype (MPO)",
"score": 1.5540019332516637,
"match_subsumer": null,
"match_subsumer_label": null,
"similarity": {
"subject_id": "HP:0004325",
"subject_label": null,
"subject_source": null,
"object_id": "MP:0002169",
"object_id": "MP:0010771",
"object_label": null,
"object_source": null,
"ancestor_id": "UPHENO:0001003",
Expand All @@ -95,10 +95,10 @@
"object_information_content": null,
"subject_information_content": null,
"ancestor_information_content": 1.5540019332516637,
"jaccard_similarity": 0.23076923076923078,
"jaccard_similarity": 0.24,
"cosine_similarity": null,
"dice_similarity": null,
"phenodigm_score": 0.5988454147360435
"phenodigm_score": 0.61070489107293
},
"score_metric": "ancestor_information_content"
}
Expand Down
Loading

0 comments on commit 5173608

Please sign in to comment.