Skip to content

Commit

Permalink
Rename script_type
Browse files Browse the repository at this point in the history
  • Loading branch information
a.brodskiy authored and anti-social committed Nov 18, 2020
1 parent 5adb833 commit b5dffd4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions elasticmagic/compiler.py
Expand Up @@ -413,8 +413,8 @@ def visit_sort(self, expr):

def visit_sort_script(self, sort_script):
res = dict(script=dict())
if sort_script.type_sort:
res['type'] = sort_script.type_sort
if sort_script.script_type:
res['type'] = sort_script.script_type
if sort_script.order:
res['order'] = sort_script.order
if sort_script.script:
Expand Down
4 changes: 2 additions & 2 deletions elasticmagic/expression.py
Expand Up @@ -482,10 +482,10 @@ def _collect_doc_classes(self):
class SortScript(Expression):
__visit_name__ = 'sort_script'

def __init__(self, script, type_sort=None, order=None):
def __init__(self, script, script_type=None, order=None):
self.script = script
self.order = order
self.type_sort = type_sort
self.script_type = script_type


class FieldOperators(object):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_expression.py
Expand Up @@ -522,7 +522,7 @@ def test_expression(self):
self.assert_expression(
SortScript(
script=Script(inline='score * 2', params={'a': 1}),
type_sort='number'
script_type='number'
),
{
'_script': {
Expand All @@ -541,7 +541,7 @@ def test_expression(self):
script=Script(
inline='score * 2', params={'a': 1}, lang='painless'
),
type_sort='number',
script_type='number',
order='asc',
),
{
Expand Down
2 changes: 1 addition & 1 deletion tests/test_search.py
Expand Up @@ -718,7 +718,7 @@ def test_aggregations(self):
inline='score * params.a'
),
order='asc',
type_sort='number',
script_type='number',
)

)
Expand Down

0 comments on commit b5dffd4

Please sign in to comment.