(self, query_filter=None)
return json.dumps(filter_dict, ensure_ascii=False)
Validate the Query Filter.

        Make sure that we have all expected attributes in the query filter
        json string. The filter dictionary evolves over time and this function
        is used to update all filters.

        Args:
            query_filter: The query filter (JSON format or dictionary)

        Returns:
            query_filter: Query filter dictionary serialized to JSON
Validate the Query Filter.
Validate the Query Filter .
def validate_filter(self, query_filter=None):
        """Validate the Query Filter.

        Make sure that we have all expected attributes in the query filter
        json string. The filter dictionary evolves over time and this function
        is used to update all filters.

        Args:
            query_filter: The query filter (JSON format or dictionary)

        Returns:
            query_filter: Query filter dictionary serialized to JSON

        """
        DEFAULT_FROM = 0
        DEFAULT_SIZE = 40 # Number of resulting documents to return
        DEFAULT_LIMIT = DEFAULT_SIZE  # Number of resulting documents to return
        DEFAULT_VALUES = {
            'from': DEFAULT_FROM,
            'size': DEFAULT_SIZE,
            'terminate_after': DEFAULT_LIMIT,
            'indices': [],
            'exclude': [],
            'order': 'asc',
            'chips': []
        }
        # If not provided, get the saved filter from the view
        if not query_filter:
            query_filter = self.query_filter

        # Make sure we have the filter as a dictionary
        if not isinstance(query_filter, dict):
            filter_dict = json.loads(query_filter)
        else:
            filter_dict = query_filter

        # Get all missing attributes and set them to their default value
        missing_attributes = list(
            set(DEFAULT_VALUES.keys()) - set(filter_dict.keys()))
        for key in missing_attributes:
            filter_dict[key] = DEFAULT_VALUES[key]

        return json.dumps(filter_dict, ensure_ascii=False)
def validate_filter ( self , query_filter = None ) : DEFAULT_FROM = 0 DEFAULT_SIZE = 40 # Number of resulting documents to return DEFAULT_LIMIT = DEFAULT_SIZE # Number of resulting documents to return DEFAULT_VALUES = { 'from' : DEFAULT_FROM , 'size' : DEFAULT_SIZE , 'terminate_after' : DEFAULT_LIMIT , 'indices' : [ ] , 'exclude' : [ ] , 'order' : 'asc' , 'chips' : [ ] } # If not provided, get the saved filter from the view if not query_filter : query_filter = self . query_filter # Make sure we have the filter as a dictionary if not isinstance ( query_filter , dict ) : filter_dict = json . loads ( query_filter ) else : filter_dict = query_filter # Get all missing attributes and set them to their default value missing_attributes = list ( set ( DEFAULT_VALUES . keys ( ) ) - set ( filter_dict . keys ( ) ) ) for key in missing_attributes : filter_dict [ key ] = DEFAULT_VALUES [ key ] return json . dumps ( filter_dict , ensure_ascii = False )