Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Include additional conditions for hashtags and project #77

Merged
merged 1 commit into from
Nov 26, 2021
Merged
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
14 changes: 13 additions & 1 deletion src/galaxy/query_builder/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,19 @@ def create_hashtag_filter_query(project_ids, hashtags, cur, conn):
for i in comment_filter_values
]

hashtag_filter = [*hashtag_tags_filters, *comment_tags_filters]
# Include cases for hasthags and comments found at the end of the string.
no_char_filter_values = [
*[f"%hotosm-project-{i}" for i in project_ids],
*[f"%{i}" for i in hashtags],
]
no_char_filter_values = [
[cur.mogrify(filter_query, (k, i)).decode() for k in ("hashtags", "comment")]
for i in no_char_filter_values
]

no_char_filter_values = [item for sublist in no_char_filter_values for item in sublist]

hashtag_filter = [*hashtag_tags_filters, *comment_tags_filters, *no_char_filter_values]

hashtag_filter = [
sql.SQL(f).format(hstore_column=sql.Identifier(HSTORE_COLUMN))
Expand Down