def test_searches_fields_debug_query_response_field(dummy_parent, mocker): from snovault.elasticsearch.searches.queries import AbstractQueryFactory mocker.patch.object(AbstractQueryFactory, '_get_index') AbstractQueryFactory._get_index.return_value = 'snovault-resources' dummy_parent._meta['params_parser']._request.environ['QUERY_STRING'] = ( 'type=Experiment&assay_title=Histone+ChIP-seq&award.project=Roadmap' '&limit=all&frame=embedded&restricted!=*&debug=true') dummy_parent._meta['query_builder'].add_post_filters() from snovault.elasticsearch.searches.fields import DebugQueryResponseField dbr = DebugQueryResponseField() r = dbr.render(parent=dummy_parent) assert 'query' in r['debug']['raw_query'] assert 'post_filter' in r['debug']['raw_query']
def cart_search(context, request): ''' Like search but takes cart params. ''' # Note the order of rendering matters for some fields, e.g. AllResponseField and # NotificationResponseField depend on results from CartSearchWithFacetsResponseField. fr = FieldedResponse(_meta={'params_parser': ParamsParser(request)}, response_fields=[ TitleResponseField(title='Cart search'), TypeResponseField(at_type=[SEARCH_TITLE]), IDResponseField(), ContextResponseField(), CartSearchWithFacetsResponseField( default_item_types=DEFAULT_ITEM_TYPES, cart=CartWithElements(request), ), AllResponseField(), NotificationResponseField(), CartFiltersResponseField(), ClearFiltersResponseFieldWithCarts(), ColumnsResponseField(), SortResponseField(), DebugQueryResponseField() ]) return fr.render()
def search(context, request): # Note the order of rendering matters for some fields, e.g. AllResponseField and # NotificationResponseField depend on results from BasicSearchWithFacetsResponseField. fr = FieldedResponse( _meta={ 'params_parser': ParamsParser(request) }, response_fields=[ TitleResponseField( title=SEARCH_TITLE ), TypeResponseField( at_type=[SEARCH_TITLE] ), IDResponseField(), ContextResponseField(), BasicSearchWithFacetsResponseField( default_item_types=DEFAULT_ITEM_TYPES ), AllResponseField(), NotificationResponseField(), FiltersResponseField(), ClearFiltersResponseField(), ColumnsResponseField(), SortResponseField(), DebugQueryResponseField() ] ) return fr.render()
def audit(context, request): fr = FieldedResponse( _meta={ 'params_parser': ParamsParser(request) }, response_fields=[ TitleResponseField( title=AUDIT_TITLE ), TypeResponseField( at_type=[AUDIT_TITLE] ), IDResponseField(), SearchBaseResponseField(), ContextResponseField(), AuditMatrixWithFacetsResponseField( default_item_types=DEFAULT_ITEM_TYPES ), NotificationResponseField(), FiltersResponseField(), TypeOnlyClearFiltersResponseField(), DebugQueryResponseField() ] ) return fr.render()
def summary(context, request): fr = FieldedResponse( _meta={ 'params_parser': ParamsParser(request) }, response_fields=[ TitleResponseField( title=SUMMARY_TITLE ), TypeResponseField( at_type=[SUMMARY_TITLE] ), IDResponseField(), SearchBaseResponseField(), ContextResponseField(), BasicMatrixWithFacetsResponseField( default_item_types=DEFAULT_ITEM_TYPES, matrix_definition_name=SUMMARY_MATRIX ), NotificationResponseField(), FiltersResponseField(), TypeOnlyClearFiltersResponseField(), DebugQueryResponseField() ] ) return fr.render()
def mouse_development(context, request): fr = FieldedResponse( _meta={ 'params_parser': ParamsParser(request) }, response_fields=[ TitleResponseField( title='Mouse Development Matrix' ), TypeResponseField( at_type=['MouseDevelopmentMatrix'] ), IDResponseField(), SearchBaseResponseField(), ContextResponseField(), BasicMatrixWithFacetsResponseField( default_item_types=DEFAULT_ITEM_TYPES, matrix_definition_name='mouse_development' ), NotificationResponseField(), FiltersResponseField(), TypeOnlyClearFiltersResponseField(), DebugQueryResponseField() ] ) return fr.render()
def entex_matrix(context, request): fr = FieldedResponse( _meta={ 'params_parser': ParamsParser(request) }, response_fields=[ TitleResponseField( title='Epigenomes from four individuals (ENTEx)' ), TypeResponseField( at_type=['EntexMatrix'] ), IDResponseField(), SearchBaseResponseField(), ContextResponseField(), MissingMatrixWithFacetsResponseField( default_item_types=DEFAULT_ITEM_TYPES, matrix_definition_name='entex' ), NotificationResponseField(), FiltersResponseField(), TypeOnlyClearFiltersResponseField(), DebugQueryResponseField() ] ) return fr.render()
def report(context, request): fr = FieldedResponse( _meta={ 'params_parser': ParamsParser(request) }, response_fields=[ TitleResponseField( title=REPORT_TITLE ), TypeResponseField( at_type=[REPORT_TITLE] ), IDResponseField(), ContextResponseField(), BasicReportWithFacetsResponseField(), AllResponseField(), NotificationResponseField(), FiltersResponseField(), TypeOnlyClearFiltersResponseField(), ColumnsResponseField(), NonSortableResponseField(), SortResponseField(), DebugQueryResponseField() ] ) return fr.render()
def encore_rna_seq_matrix(context, request): fr = FieldedResponse( _meta={'params_parser': ParamsParser(request)}, response_fields=[ TitleResponseField(title='ENCORE RNA-seq Matrix'), TypeResponseField(at_type=['EncoreRnaSeqMatrix']), IDResponseField(), SearchBaseResponseField(), ContextResponseField(), MissingMatrixWithFacetsResponseField( default_item_types=DEFAULT_ITEM_TYPES, matrix_definition_name='encore_rna_seq_matrix'), NotificationResponseField(), FiltersResponseField(), TypeOnlyClearFiltersResponseField(), DebugQueryResponseField() ]) return fr.render()
def cart_matrix(context, request): fr = FieldedResponse( _meta={'params_parser': ParamsParser(request)}, response_fields=[ TitleResponseField(title='Cart matrix'), TypeResponseField(at_type=[MATRIX_TITLE]), IDResponseField(), SearchBaseResponseField(search_base='/cart-search/'), ContextResponseField(), CartMatrixWithFacetsResponseField( default_item_types=DEFAULT_ITEM_TYPES, cart=CartWithElements(request), ), NotificationResponseField(), CartFiltersResponseField(), TypeOnlyClearFiltersResponseFieldWithCarts(), DebugQueryResponseField() ]) return fr.render()