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()
def test_searches_fields_title_field_title_value(): from snovault.elasticsearch.searches.fields import TitleResponseField tf = TitleResponseField(title='Search') rtf = tf.render() assert rtf == {'title': 'Search'}
def test_searches_fields_title_response_field_init(): from snovault.elasticsearch.searches.fields import TitleResponseField tf = TitleResponseField() assert isinstance(tf, TitleResponseField)