Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ sh /app/scripts/start_server.sh &
coverage erase
# spec validation
python -m spec.validate
# run importer/, relation_engine_server/, and spec/ tests, skip test_query.py
coverage run --branch -m pytest --ignore=spec/test/stored_queries/test_query.py
# run importer/, relation_engine_server/, and spec/ tests
coverage run --branch -m pytest
# RE client tests
PYTHONPATH=client_src python -m pytest client_src/test
coverage html --omit=*/test_*
2 changes: 2 additions & 0 deletions spec/stored_queries/generic/fulltext_search.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Search a collection with a fulltext index with an attribute name and search text
# Also supports filtering by outer-level attributes
# Not recommended for fast searching because it can be very slow and even timeout at 60s
name: fulltext_search
params:
type: object
Expand Down
2 changes: 2 additions & 0 deletions spec/stored_queries/taxonomy/taxonomy_search_sci_name.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Should be REVISED then DEPRECATED
#
# Search for a taxon with a scientific name
# Offset is limited to 10k
name: taxonomy_search_sci_name
Expand Down
2 changes: 2 additions & 0 deletions spec/stored_queries/taxonomy/taxonomy_search_species.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# DEPRECATED. See taxonomy_search_species_strains and taxonomy_search_species_strains_no_sort
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you know if anyone / anything is actually using this?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really don't think so

#
# Search for a species/strain. Similar to search_sci_name, but simpler and quicker
name: taxonomy_search_species
params:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
# Search ncbi_taxon collection for species/strains by scientific name
name: taxonomy_ncbi_species
name: taxonomy_search_species_strain
params:
type: object
required: [search_text]
required: ["@taxon_coll", sciname_field, search_text]
additionalProperties: false
properties:
"@taxon_coll":
type: string
title: Taxon collection name
examples: [ncbi_taxon, gtdb_taxon]
search_text:
type: string
title: Search text
examples: [escherichia, es]
description: Text to search on the search attribute values
sciname_field:
type: string
title: Scientific name field name
examples: [scientific_name, name]
ts:
type: [integer, "null"]
title: Versioning timestamp
Expand Down Expand Up @@ -43,7 +51,7 @@ query: |
FOR tok IN search_text__wordboundmod_icu_toks // prepend "prefix:"
RETURN CONCAT("prefix:", tok)
)
FOR doc IN FULLTEXT(ncbi_taxon, "scientific_name", search_text__fulltext)
FOR doc IN FULLTEXT(@@taxon_coll, @sciname_field, search_text__fulltext)
FILTER @ts ? doc.created <= @ts AND doc.expired >= @ts : true
FILTER doc.rank IN ["species", "strain"] OR doc.strain
LET doc_sciname__norm = REGEX_REPLACE(LOWER(TRIM(doc.scientific_name)), "\\s+", " ") // for exact matching
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
# Search ncbi_taxon collection for species/strains by scientific name
# Except do not sort, just return the first however many documents
# Useful for short prefixes (e.g., "s") that would be expensive yet not meaningful to sort
name: taxonomy_ncbi_species_no_sort
name: taxonomy_search_species_strain_no_sort
params:
type: object
required: [search_text]
required: ["@taxon_coll", sciname_field, search_text]
additionalProperties: false
properties:
"@taxon_coll":
type: string
title: Taxon collection name
examples: [ncbi_taxon, gtdb_taxon]
sciname_field:
type: string
title: Scientific name field name
examples: [scientific_name, name]
search_text:
type: string
title: Search text
Expand Down Expand Up @@ -43,7 +51,7 @@ query: |
FOR tok IN search_text__wordboundmod_icu_toks // prepend "prefix:"
RETURN CONCAT("prefix:", tok)
)
FOR doc IN FULLTEXT(ncbi_taxon, "scientific_name", search_text__fulltext)
FOR doc IN FULLTEXT(@@taxon_coll, @sciname_field, search_text__fulltext)
FILTER @ts ? doc.created <= @ts AND doc.expired >= @ts : true
FILTER doc.rank IN ["species", "strain"] OR doc.strain
LIMIT @offset ? @offset : 0, @limit ? @limit : 20
Expand Down
Loading