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
58ce555f
Commit
58ce555f
authored
Jan 07, 2016
by
Clinton Blackburn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated id and name analyzers
Using a lowercase keyword analyzer to better support wildcard queries.
parent
8a698034
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
17 deletions
+5
-17
course_discovery/apps/api/v1/tests/test_views.py
+1
-1
course_discovery/apps/courses/config.py
+3
-15
course_discovery/apps/courses/models.py
+1
-1
No files found.
course_discovery/apps/api/v1/tests/test_views.py
View file @
58ce555f
...
@@ -239,7 +239,7 @@ class CourseViewSetTests(ElasticsearchTestMixin, SerializationMixin, APITestCase
...
@@ -239,7 +239,7 @@ class CourseViewSetTests(ElasticsearchTestMixin, SerializationMixin, APITestCase
"must"
:
[
"must"
:
[
{
{
"term"
:
{
"term"
:
{
"course.name
.lowercase_sort
"
:
name
"course.name"
:
name
}
}
}
}
]
]
...
...
course_discovery/apps/courses/config.py
View file @
58ce555f
...
@@ -2,7 +2,7 @@ COURSES_INDEX_CONFIG = {
...
@@ -2,7 +2,7 @@ COURSES_INDEX_CONFIG = {
'settings'
:
{
'settings'
:
{
'analysis'
:
{
'analysis'
:
{
'analyzer'
:
{
'analyzer'
:
{
'
case_insensitive_sort
'
:
{
'
lowercase_keyword
'
:
{
'tokenizer'
:
'keyword'
,
'tokenizer'
:
'keyword'
,
'filter'
:
[
'lowercase'
]
'filter'
:
[
'lowercase'
]
}
}
...
@@ -14,23 +14,11 @@ COURSES_INDEX_CONFIG = {
...
@@ -14,23 +14,11 @@ COURSES_INDEX_CONFIG = {
'properties'
:
{
'properties'
:
{
'id'
:
{
'id'
:
{
'type'
:
'string'
,
'type'
:
'string'
,
'analyzer'
:
'english'
,
'analyzer'
:
'lowercase_keyword'
'fields'
:
{
'lowercase_sort'
:
{
'type'
:
'string'
,
'analyzer'
:
'case_insensitive_sort'
}
}
},
},
'name'
:
{
'name'
:
{
'type'
:
'string'
,
'type'
:
'string'
,
'analyzer'
:
'english'
,
'analyzer'
:
'lowercase_keyword'
'fields'
:
{
'lowercase_sort'
:
{
'type'
:
'string'
,
'analyzer'
:
'case_insensitive_sort'
}
}
}
}
}
}
}
}
...
...
course_discovery/apps/courses/models.py
View file @
58ce555f
...
@@ -102,7 +102,7 @@ class Course(object):
...
@@ -102,7 +102,7 @@ class Course(object):
"""
"""
query
.
setdefault
(
'from'
,
offset
)
query
.
setdefault
(
'from'
,
offset
)
query
.
setdefault
(
'size'
,
limit
)
query
.
setdefault
(
'size'
,
limit
)
query
.
setdefault
(
'sort'
,
{
'id
.lowercase_sort
'
:
'asc'
})
query
.
setdefault
(
'sort'
,
{
'id'
:
'asc'
})
logger
.
debug
(
'Querying [
%
s]:
%
s'
,
cls
.
_index
,
query
)
logger
.
debug
(
'Querying [
%
s]:
%
s'
,
cls
.
_index
,
query
)
response
=
cls
.
_es_client
()
.
search
(
index
=
cls
.
_index
,
doc_type
=
cls
.
doc_type
,
body
=
query
)
response
=
cls
.
_es_client
()
.
search
(
index
=
cls
.
_index
,
doc_type
=
cls
.
doc_type
,
body
=
query
)
...
...
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