Skip to content

Commit

Permalink
Merge pull request #1360 from microbiomedata/1297-search-by-id
Browse files Browse the repository at this point in the history
Add study id to partial search
  • Loading branch information
marySalvi authored Aug 22, 2024
2 parents 378cc03 + 3dcb900 commit 3eb6b43
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions nmdc_server/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ def text_search(terms: str, limit=6, db: Session = Depends(get_db)):
"field": "name",
"op": "like",
}
study_id_filter = {
"table": "study",
"value": terms.lower(),
"field": "id",
"op": "like",
}
study_description_filter = {
"table": "study",
"value": terms.lower(),
Expand Down Expand Up @@ -104,6 +110,7 @@ def text_search(terms: str, limit=6, db: Session = Depends(get_db)):
filters = crud.text_search(db, terms, limit)
plaintext_filters = [
query.SimpleConditionSchema(**study_name_filter),
query.SimpleConditionSchema(**study_id_filter),
query.SimpleConditionSchema(**study_description_filter),
query.SimpleConditionSchema(**study_title_filter),
query.SimpleConditionSchema(**biosample_name_filter),
Expand Down

0 comments on commit 3eb6b43

Please sign in to comment.