(self, db_uri, parsed_query, db_name, collection_name)
return OrderedDict({
            'queryMask': parsed_query['queryMask'],
            'indexStatus': indexStatus,
            'parsed': parsed_query,
            'namespace': namespace,
            'queryAnalysis': query_analysis,
            'indexAnalysis': index_analysis,
            'recommendation': recommendation
        })
Generates a comprehensive report on the raw query
Generates a comprehensive report on the raw query
Generates a comprehensive report on the raw query
def generate_query_report(self, db_uri, parsed_query, db_name, collection_name):
        """Generates a comprehensive report on the raw query"""
        index_analysis = None
        recommendation = None
        namespace = parsed_query['ns']
        indexStatus = "unknown"

        index_cache_entry = self._ensure_index_cache(db_uri,
                                                     db_name,
                                                     collection_name)


        query_analysis = self._generate_query_analysis(parsed_query,
                                                       db_name,
                                                       collection_name)
        if ((query_analysis['analyzedFields'] != []) and
             query_analysis['supported']):
            index_analysis = self._generate_index_analysis(query_analysis,
                                                           index_cache_entry['indexes'])
            indexStatus = index_analysis['indexStatus']
            if index_analysis['indexStatus'] != 'full':
                recommendation = self._generate_recommendation(query_analysis,
                                                               db_name,
                                                               collection_name)
                # a temporary fix to suppress faulty parsing of $regexes.
                # if the recommendation cannot be re-parsed into yaml, we assume
                # it is invalid.
                if not validate_yaml(recommendation['index']):
                    recommendation = None
                    query_analysis['supported'] = False


        # QUERY REPORT
        return OrderedDict({
            'queryMask': parsed_query['queryMask'],
            'indexStatus': indexStatus,
            'parsed': parsed_query,
            'namespace': namespace,
            'queryAnalysis': query_analysis,
            'indexAnalysis': index_analysis,
            'recommendation': recommendation
        })
def generate_query_report ( self , db_uri , parsed_query , db_name , collection_name ) : index_analysis = None recommendation = None namespace = parsed_query [ 'ns' ] indexStatus = "unknown" index_cache_entry = self . _ensure_index_cache ( db_uri , db_name , collection_name ) query_analysis = self . _generate_query_analysis ( parsed_query , db_name , collection_name ) if ( ( query_analysis [ 'analyzedFields' ] != [ ] ) and query_analysis [ 'supported' ] ) : index_analysis = self . _generate_index_analysis ( query_analysis , index_cache_entry [ 'indexes' ] ) indexStatus = index_analysis [ 'indexStatus' ] if index_analysis [ 'indexStatus' ] != 'full' : recommendation = self . _generate_recommendation ( query_analysis , db_name , collection_name ) # a temporary fix to suppress faulty parsing of $regexes. # if the recommendation cannot be re-parsed into yaml, we assume # it is invalid. if not validate_yaml ( recommendation [ 'index' ] ) : recommendation = None query_analysis [ 'supported' ] = False # QUERY REPORT return OrderedDict ( { 'queryMask' : parsed_query [ 'queryMask' ] , 'indexStatus' : indexStatus , 'parsed' : parsed_query , 'namespace' : namespace , 'queryAnalysis' : query_analysis , 'indexAnalysis' : index_analysis , 'recommendation' : recommendation } )