def should_include_or_exclude()

in ees_network_drive/indexing_rule.py [0:0]


    def should_include_or_exclude(self, pattern_dict, is_present_in_include, file_details, pattern_type):
        """Function to decide wether to include the file or exclude it based on the indexing rules defined in the configuration
           :param pattern_dict: Dictionary containing key value pairs as filter type and list of patterns
           :param is_present_in_include: Used to check if any pattern is already present in include type
           :param file_details: dictionary containing file properties
           :param pattern_type: include/exclude
        """
        should_index = True
        for filtertype, pattern in pattern_dict.items():
            for value in (pattern or []):
                if is_present_in_include and (value in (is_present_in_include.get(filtertype) or [])):
                    pattern.remove(value)
            result = self.follows_indexing_rule(filtertype, pattern, file_details, pattern_type)
            if result is False:
                should_index = False
            elif result is True:
                return True
        return should_index