File tree Expand file tree Collapse file tree 2 files changed +24
-6
lines changed
Expand file tree Collapse file tree 2 files changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -422,7 +422,7 @@ async def lookup(string: str,
422422 taxa_filters .append (f'taxa:"{ taxon } "' )
423423
424424 # We also need to include entries that don't have taxa specified.
425- taxa_filters .append ('-taxa:[* TO *] ' )
425+ taxa_filters .append ('taxon_specific:false ' )
426426
427427 # Combine all taxa filters.
428428 filters .append ('(' + " OR " .join (taxa_filters ) + ')' )
@@ -467,7 +467,7 @@ async def lookup(string: str,
467467 "fields" : "*, score" ,
468468 "params" : inner_params ,
469469 }
470- logging . debug (f"Query: { json .dumps (params , indent = 2 )} " )
470+ print (f"Query: { json .dumps (params , indent = 2 )} " )
471471
472472 query_url = f"http://{ SOLR_HOST } :{ SOLR_PORT } /solr/name_lookup/select"
473473 async with httpx .AsyncClient (timeout = None ) as client :
Original file line number Diff line number Diff line change @@ -238,7 +238,25 @@ def test_only_taxa_queries():
238238 'string' : 'FTD' ,
239239 'only_taxa' : 'NCBITaxon:9031' ,
240240 })
241- results_all_ftd = response .json ()
242- assert len (results_all_ftd ) == 2
243- assert results_all_ftd [0 ]['curie' ] == 'NCBIGene:378899'
244- assert results_all_ftd [1 ]['curie' ] == 'MONDO:0010857'
241+ results_ftd_with_only_taxon = response .json ()
242+ assert len (results_ftd_with_only_taxon ) == 2
243+ assert results_ftd_with_only_taxon [0 ]['curie' ] == 'NCBIGene:378899'
244+ assert results_ftd_with_only_taxon [1 ]['curie' ] == 'MONDO:0010857'
245+
246+ response = client .get ("/lookup" , params = {
247+ 'string' : 'FTD' ,
248+ 'only_taxa' : 'NCBITaxon:9031' ,
249+ 'biolink_type' : 'biolink:Gene'
250+ })
251+ results_ftd_gene_with_only_taxon = response .json ()
252+ assert len (results_ftd_gene_with_only_taxon ) == 1
253+ assert results_ftd_gene_with_only_taxon [0 ]['curie' ] == 'NCBIGene:378899'
254+
255+ response = client .get ("/lookup" , params = {
256+ 'string' : 'FTD' ,
257+ 'only_taxa' : 'NCBITaxon:9031' ,
258+ 'biolink_type' : 'biolink:Disease'
259+ })
260+ results_ftd_disease_with_only_taxon = response .json ()
261+ assert len (results_ftd_disease_with_only_taxon ) == 1
262+ assert results_ftd_disease_with_only_taxon [0 ]['curie' ] == 'MONDO:0010857'
You can’t perform that action at this time.
0 commit comments