Skip to content
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

Fix quick search casing issue - v1 patch #347

Merged
merged 1 commit into from
Jul 16, 2024
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
12 changes: 6 additions & 6 deletions middleware/quick_search_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
INNER JOIN
state_names ON agencies.state_iso = state_names.state_iso
WHERE
(data_sources.name LIKE '%{0}%' OR data_sources.description LIKE '%{0}%' OR data_sources.record_type LIKE '%{0}%' OR data_sources.tags LIKE '%{0}%')
AND (agencies.county_name LIKE '%{1}%' OR substr(agencies.county_name,3,length(agencies.county_name)-4) || ' County' LIKE '%{1}%'
OR agencies.state_iso LIKE '%{1}%' OR agencies.municipality LIKE '%{1}%' OR agencies.agency_type LIKE '%{1}%' OR agencies.jurisdiction_type LIKE '%{1}%'
OR agencies.name LIKE '%{1}%' OR state_names.state_name LIKE '%{1}%')
(data_sources.name ILIKE '%{0}%' OR data_sources.description ILIKE '%{0}%' OR data_sources.record_type ILIKE '%{0}%' OR data_sources.tags ILIKE '%{0}%')

Check failure on line 46 in middleware/quick_search_query.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] middleware/quick_search_query.py#L46 <501>

line too long (160 > 79 characters)
Raw output
./middleware/quick_search_query.py:46:80: E501 line too long (160 > 79 characters)

Check warning on line 46 in middleware/quick_search_query.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] middleware/quick_search_query.py#L46 <291>

trailing whitespace
Raw output
./middleware/quick_search_query.py:46:161: W291 trailing whitespace
AND (agencies.county_name ILIKE '%{1}%' OR substr(agencies.county_name,3,length(agencies.county_name)-4) || ' County' ILIKE '%{1}%'

Check failure on line 47 in middleware/quick_search_query.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] middleware/quick_search_query.py#L47 <501>

line too long (139 > 79 characters)
Raw output
./middleware/quick_search_query.py:47:80: E501 line too long (139 > 79 characters)

Check warning on line 47 in middleware/quick_search_query.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] middleware/quick_search_query.py#L47 <291>

trailing whitespace
Raw output
./middleware/quick_search_query.py:47:140: W291 trailing whitespace
OR agencies.state_iso ILIKE '%{1}%' OR agencies.municipality ILIKE '%{1}%' OR agencies.agency_type LIKE '%{1}%' OR agencies.jurisdiction_type ILIKE '%{1}%'

Check failure on line 48 in middleware/quick_search_query.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] middleware/quick_search_query.py#L48 <501>

line too long (167 > 79 characters)
Raw output
./middleware/quick_search_query.py:48:80: E501 line too long (167 > 79 characters)

Check warning on line 48 in middleware/quick_search_query.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] middleware/quick_search_query.py#L48 <291>

trailing whitespace
Raw output
./middleware/quick_search_query.py:48:168: W291 trailing whitespace
OR agencies.name ILIKE '%{1}%' OR state_names.state_name ILIKE '%{1}%')

Check failure on line 49 in middleware/quick_search_query.py

View workflow job for this annotation

GitHub Actions / flake8

[flake8] middleware/quick_search_query.py#L49 <501>

line too long (83 > 79 characters)
Raw output
./middleware/quick_search_query.py:49:80: E501 line too long (83 > 79 characters)
AND data_sources.approval_status = 'approved'
AND data_sources.url_status not in ('broken', 'none found')

Expand All @@ -67,7 +67,7 @@
:return: A list of dictionaries representing the search results.
"""
print(f"Query parameters: '%{search}%', '%{location}%'")
cursor.execute(QUICK_SEARCH_SQL.format(search.title(), location.title()))
cursor.execute(QUICK_SEARCH_SQL.format(search, location))
results = cursor.fetchall()

return results
Expand Down Expand Up @@ -95,7 +95,7 @@
print(f"Query parameters: '%{depluralized_search_term}%', '%{location}%'")

cursor.execute(
QUICK_SEARCH_SQL.format(depluralized_search_term.title(), location.title())
QUICK_SEARCH_SQL.format(depluralized_search_term, location)
)
results = cursor.fetchall()

Expand Down
Loading