Skip to content

Commit

Permalink
Fixed #88: A search query with a tilde (~) returns an Internal Server…
Browse files Browse the repository at this point in the history
… Error, by moving from urllib to requests
  • Loading branch information
m-i-l committed Jan 21, 2023
1 parent e8c19a5 commit 1faa333
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/web/content/dynamic/searchmysite/searchutils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from flask import url_for, current_app
from urllib.request import urlopen, Request
import requests
import json
import math
from datetime import datetime
Expand Down Expand Up @@ -132,10 +132,9 @@ def do_search(query_params, query_facets, params, start, default_filter_queries,
solr_search['params'] = query_params
solr_search['facet'] = query_facets
solr_search_json = json.dumps(solr_search)
# current_app.logger.debug('solr_search_json: {}'.format(solr_search_json))
req = Request(solrquery, solr_search_json.encode("utf8"), searchmysite.solr.solr_request_headers)
response = urlopen(req)
search_results = json.load(response)
#current_app.logger.debug('solr_search_json: {}'.format(solr_search_json))
response = requests.post(url=solrquery, data=solr_search_json.encode("utf8"), headers=searchmysite.solr.solr_request_headers)
search_results = response.json()
return search_results


Expand Down

0 comments on commit 1faa333

Please sign in to comment.