Changeset 8e9f2c8950dd…
Parent 7e4cf01a24ce…
by
Changes to one file · Browse files at 8e9f2c8950dd Showing diff from parent 7e4cf01a24ce Diff from another changeset...
@@ -933,16 +933,18 @@
def __init__(self, field, text, type="boolean", slop=0, fuzziness=None,
prefix_length=0, max_expansions=2147483647, operator="or",
- analyzer=None, boost=1.0, minimum_should_match=None, **kwargs):
+ analyzer=None, boost=1.0, minimum_should_match=None, cutoff_frequency=None, **kwargs):
super(TextQuery, self).__init__(**kwargs)
self.queries = {}
self.add_query(field, text, type, slop, fuzziness,
prefix_length, max_expansions,
- operator, analyzer, boost, minimum_should_match)
+ operator, analyzer, boost, minimum_should_match,
+ cutoff_frequency=cutoff_frequency)
def add_query(self, field, text, type="boolean", slop=0, fuzziness=None,
prefix_length=0, max_expansions=2147483647,
- operator="or", analyzer=None, boost=1.0, minimum_should_match=None):
+ operator="or", analyzer=None, boost=1.0, minimum_should_match=None,
+ cutoff_frequency=None):
if type not in self._valid_types:
raise QueryError("Invalid value '%s' for type: allowed values are %s" % (type, self._valid_types))
if operator not in self._valid_operators:
@@ -964,6 +966,8 @@ query["boost"] = boost
if analyzer:
query["analyzer"] = analyzer
+ if cutoff_frequency is not None:
+ query["cutoff_frequency"] = cutoff_frequency
if minimum_should_match:
query["minimum_should_match"] = minimum_should_match
self.queries[field] = query
@@ -1008,8 +1012,7 @@ if not fields:
raise QueryError("At least one field must be defined for multi_match")
- query = {'type': type, 'query': text, 'fields': fields}
- query['use_dis_max']=use_dis_max
+ query = {'type': type, 'query': text, 'fields': fields, 'use_dis_max': use_dis_max}
if slop:
query["slop"] = slop
if fuzziness is not None:
|
Loading...