aboutsummaryrefslogtreecommitdiff
path: root/gn2/wqflask
diff options
context:
space:
mode:
authorzsloan2024-06-26 21:42:12 +0000
committerAlexander_Kabui2024-08-28 15:02:45 +0300
commit5753be342c10a7d2a23ffd7ab8cd8238732edd95 (patch)
treeca721621f5a5818bcb87a887d9fa9241a9aec611 /gn2/wqflask
parent350b4b8c84ed680d82dbd616bb69bae919fce232 (diff)
downloadgenenetwork2-5753be342c10a7d2a23ffd7ab8cd8238732edd95.tar.gz
Fix LRS/LOD Xapian searches when there are 5 terms (where position range is included)
Diffstat (limited to 'gn2/wqflask')
-rw-r--r--gn2/wqflask/search_results.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/gn2/wqflask/search_results.py b/gn2/wqflask/search_results.py
index accc3a53..357b3f09 100644
--- a/gn2/wqflask/search_results.py
+++ b/gn2/wqflask/search_results.py
@@ -26,7 +26,7 @@ from gn2.utility.hmac import hmac_creation
from gn2.utility.tools import get_setting, GN2_BASE_URL, GN3_LOCAL_URL
from gn2.utility.type_checking import is_str
-MAX_SEARCH_RESULTS = 20000 # Max number of search results, passed to Xapian search
+MAX_SEARCH_RESULTS = 20000 # Max number of search results, passed to Xapian search (this needs to match the value in GN3!)
class SearchResultPage:
#maxReturn = 3000
@@ -517,14 +517,14 @@ def create_xapian_term(dataset, term):
return xapian_term + f"author:{search_term[0]}"
case 'LRS':
xapian_term += f"peak:{search_term[0]}..{search_term[1]}"
- if len(term) == 5:
- xapian_term += f"peakchr:{search_term[2].lower().replace('chr', '')} AND peakmb:{float(search_term[3])*10**6}..{float(search_term[4])*10**6}"
+ if len(search_term) == 5:
+ xapian_term += f" AND peakchr:{search_term[2].lower().replace('chr', '')} AND peakmb:{float(search_term[3])}..{float(search_term[4])}"
return xapian_term
case 'LOD': # Basically just LRS search but all values are multiplied by 4.61
xapian_term += f"peak:{float(search_term[0]) * 4.61}..{float(search_term[1]) * 4.61}"
- if len(term) == 5:
- xapian_term += f"peakchr:{search_term[2].lower().replace('chr', '')} AND "
- xapian_term += f"peakmb:{float(search_term[3]) * 4.61}..{float(search_term[4]) * 4.61}"
+ if len(search_term) == 5:
+ xapian_term += f" AND peakchr:{search_term[2].lower().replace('chr', '')}"
+ xapian_term += f" AND peakmb:{float(search_term[3])}..{float(search_term[4])}"
return xapian_term
case None:
return xapian_term + f"{search_term[0]}"