def _generate_type_code_query(self, value):
        """Generate type-code queries.

        Notes:
            If the value of the type-code query exists in `TYPECODE_VALUE_TO_FIELD_AND_VALUE_PAIRS_MAPPING, then we
            query the specified field, along with the given value according to the mapping.
            See: https://github.com/inspirehep/inspire-query-parser/issues/79
            Otherwise, we query both ``document_type`` and ``publication_info``.
        """
        mapping_for_value = self.TYPECODE_VALUE_TO_FIELD_AND_VALUE_PAIRS_MAPPING.get(value, None)

        if mapping_for_value:
            return generate_match_query(*mapping_for_value, with_operator_and=True)
        else:
            return {
                'bool': {
                    'minimum_should_match': 1,
                    'should': [
                        generate_match_query('document_type', value, with_operator_and=True),
                        generate_match_query('publication_type', value, with_operator_and=True),
                    ]
                }
            }
def _generate_type_code_query ( self , value ) : mapping_for_value = self . TYPECODE_VALUE_TO_FIELD_AND_VALUE_PAIRS_MAPPING . get ( value , None ) if mapping_for_value : return generate_match_query ( * mapping_for_value , with_operator_and = True ) else : return { 'bool' : { 'minimum_should_match' : 1 , 'should' : [ generate_match_query ( 'document_type' , value , with_operator_and = True ) , generate_match_query ( 'publication_type' , value , with_operator_and = True ) , ] } }
Generate type-code queries.

        Notes:
            If the value of the type-code query exists in `TYPECODE_VALUE_TO_FIELD_AND_VALUE_PAIRS_MAPPING, then we
            query the specified field, along with the given value according to the mapping.
            See: https://github.com/inspirehep/inspire-query-parser/issues/79
            Otherwise, we query both ``document_type`` and ``publication_info``.