-
Notifications
You must be signed in to change notification settings - Fork 80
DataTables load using AJAX, Search by metadata on studies page #1006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
616300f
d595016
90313f7
fb5eef3
1ffd4bc
16257c4
9ccc098
abeb46f
259bec2
b8472a8
cf6ca77
cd4f66e
ce4d334
58b28cd
1872555
4b7ffcf
515f0f6
21b17d6
04f87f4
ee4c9e2
ef16d18
fbe7c74
e0f22d0
0df6666
5085c35
ea69fe8
3a12f87
25ae8f2
e01e224
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,12 +11,14 @@ | |
|
||
from tornado.web import authenticated, HTTPError | ||
from tornado.gen import coroutine, Task | ||
from pyparsing import ParseException | ||
|
||
from qiita_core.exceptions import IncompetentQiitaDeveloperError | ||
from qiita_db.user import User | ||
from qiita_db.study import Study, StudyPerson | ||
from qiita_db.search import QiitaStudySearch | ||
from qiita_db.metadata_template import SampleTemplate | ||
from qiita_db.exceptions import QiitaDBIncompatibleDatatypeError | ||
from qiita_db.util import get_table_cols | ||
from qiita_pet.handlers.base_handlers import BaseHandler | ||
from qiita_pet.handlers.util import study_person_linkifier, pubmed_linkifier | ||
|
@@ -176,7 +178,30 @@ def get(self, ignore): | |
if query != "": | ||
# Search for samples matching the query | ||
search = QiitaStudySearch() | ||
res, meta = search(query, User(user)) | ||
try: | ||
res, meta = search(query, User(user)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just use self.current_user (less objs instantiations) |
||
except ParseException: | ||
print ">>>>>>ParseException" | ||
self.clear() | ||
self.set_status(400) | ||
self.write('Malformed search query. Please read "search help" ' | ||
'and try again.') | ||
return | ||
except QiitaDBIncompatibleDatatypeError as e: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Under what types of situations would this arise? I didn't see a test case on it, so just curious There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. someone tries to search over both varchar and numeric on same column There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure this should raise an error. Let's have 2 studies with column Ph, one has only float values (created as float) and the other one has a combination of float/str (created as str). If a user searches for Ph = 0.4 it should return the samples that match that criteria from both studies, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if it has a combination of float/str, the entire column will be varchar and we can't do proper numeric comparisons vs a string. This is a known issue with the search engine that will get fixed during the refactor. Before this explicit error raising the search would just 500 error if you do this type of search. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
print ">>>>>>QiitaDBIncompatibleDatatypeError" | ||
self.clear() | ||
self.set_status(400) | ||
searchmsg = 'BUUUUUTS' | ||
self.write(searchmsg) | ||
return | ||
except: | ||
print ">>>>>>GENERIC ERROR" | ||
# catch any other error as generic server error | ||
self.set_status(500) | ||
self.write("Server error during search. Please try again " | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this indicative of an actual problem that should be logged? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Wasn't logged in the code I copy-pasted to here but can add it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please do 👍 |
||
"later") | ||
if not res: | ||
res = {} | ||
info = _build_study_info(search_type, self.current_user, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this call only needs to be done once and can be done outside of the conditions if |
||
studies=res.keys()) | ||
else: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if query