Skip to content

Start improving search #988

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

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
address comments
  • Loading branch information
squirrelo committed Mar 18, 2015
commit 4a1e37c4a2831ee69e8ae8b444711865fe5bc69d
15 changes: 0 additions & 15 deletions qiita_db/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1144,21 +1144,6 @@ def study(self):
"processed_data_id=%s".format(self._study_processed_table),
[self._id])[0]

@property
def samples(self):
"""Returns samples available in this processed data

Returns
-------
generator of str
Sample_ids available according to the prep template
"""
# Get the samples available for the prep template
pid = PreprocessedData(self.preprocessed_data).prep_template
conn_handler = SQLConnectionHandler()
sql = "SELECT sample_id FROM qiita.prep_{0}".format(pid)
return (x[0] for x in conn_handler.execute_fetchall(sql))

def data_type(self, ret_id=False):
"""Returns the data_type or data_type_id

Expand Down
4 changes: 3 additions & 1 deletion qiita_pet/handlers/analysis_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
check_access_to_analysis_result,
get_table_cols,
filepath_ids_to_rel_paths)
from qiita_ware.search import search, count_metadata
from qiita_db.search import QiitaStudySearch
from qiita_ware.search import count_metadata
from qiita_db.exceptions import (
QiitaDBIncompatibleDatatypeError, QiitaDBUnknownIDError)

Expand Down Expand Up @@ -140,6 +141,7 @@ def post(self):

# run through action requested
if action == "search":
search = QiitaStudySearch()
query = str(self.get_argument("query"))
try:
results, meta_headers = search(query, user)
Expand Down
9 changes: 0 additions & 9 deletions qiita_ware/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

from future.utils import viewvalues

from qiita_db.search import QiitaStudySearch


def count_metadata(results, meta_cols):
Copy link
Contributor

Choose a reason for hiding this comment

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

this is not counting anything, so the name and the description are misleading. Can you change the name to something like collapse_search_results or something similar? Also I'm unsure if this function should be exposed to qiita_pet or should be private and be included in the search function below, which will make it useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is counting the number of occurrences of each metadata value for each metadata column. It's there specifically for qiita_pet.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, sorry, I got confused with the code.

"""Counts the metadata found in a search, and returns these counts
Expand Down Expand Up @@ -50,10 +48,3 @@ def double_comprehension(results):
studycount[study_id][cat] = Counter(meta_vals[pos + 1])

return fullcount, studycount


def search(searchstr, user, study=None):
""" Passthrough for qiita_db search object. See object for documentation
"""
search = QiitaStudySearch()
return search(searchstr, user, study)