Kiln » Dependencies » pyes Read More
Clone URL:  
Pushed to one repository · View In Graph Contained in master

Added cutoff_frequency parameter to match query

Changeset 8e9f2c8950dd

Parent 7e4cf01a24ce

by Alberto Paro

Changes to one file · Browse files at 8e9f2c8950dd Showing diff from parent 7e4cf01a24ce Diff from another changeset...

Change 1 of 3 Show Entire File pyes/​query.py Stacked
 
933
934
935
936
 
937
938
939
940
941
 
 
942
943
944
945
 
 
946
947
948
 
964
965
966
 
 
967
968
969
 
1008
1009
1010
1011
1012
 
1013
1014
1015
 
933
934
935
 
936
937
938
939
940
 
941
942
943
944
945
 
946
947
948
949
950
 
966
967
968
969
970
971
972
973
 
1012
1013
1014
 
 
1015
1016
1017
1018
@@ -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: