Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
course-discovery
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
course-discovery
Commits
9e60a62b
Commit
9e60a62b
authored
Aug 08, 2016
by
Michael Frey
Committed by
GitHub
Aug 08, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #224 from edx/mjfrey/wrap_query
Wrap ES search query in parens to perserve semantics
parents
1a323089
8f7527f6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
course_discovery/apps/course_metadata/utils.py
+4
-0
No files found.
course_discovery/apps/course_metadata/utils.py
View file @
9e60a62b
...
@@ -13,6 +13,10 @@ def clean_query(query):
...
@@ -13,6 +13,10 @@ def clean_query(query):
# Ensure the query is lowercase, since that is how we index our data.
# Ensure the query is lowercase, since that is how we index our data.
query
=
query
.
lower
()
query
=
query
.
lower
()
# Specifying a SearchQuerySet filter will append an explicit AND clause to the query, thus changing its semantics.
# So we wrap parentheses around the original query in order to preserve the semantics.
query
=
'({qs})'
.
format
(
qs
=
query
)
# Ensure all operators are uppercase
# Ensure all operators are uppercase
for
operator
in
RESERVED_ELASTICSEARCH_QUERY_OPERATORS
:
for
operator
in
RESERVED_ELASTICSEARCH_QUERY_OPERATORS
:
old
=
' {0} '
.
format
(
operator
.
lower
())
old
=
' {0} '
.
format
(
operator
.
lower
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment