Пример #1
0
class HistoryApiSearchRequest(ListingSchema):
    id = search_fields.FilterField(
        NumberTermSchema,
        doc_template='docs/generic/fields/number_term_field.html',
        doc_base_url='/histories',
        doc_field_name='ID',
    )
    action = search_fields.FilterField(
        StringMatchSchema,
        doc_template='docs/generic/fields/string_match_field.html',
        doc_base_url='/histories',
        doc_field_name='action',
    )
    change_user_id = search_fields.FilterField(
        NumberTermSchema,
        doc_template='docs/generic/fields/number_term_field.html',
        doc_base_url='/histories',
        doc_field_name='change_user_id',
    )
    change_timestamp = search_fields.FilterField(
        DateTermSchema,
        doc_template='docs/generic/fields/number_term_field.html',
        doc_base_url='/histories',
        doc_field_name='change_timestamp',
    )
    message = search_fields.FilterField(
        StringMatchSchema,
        doc_template='docs/generic/fields/string_match_field.html',
        doc_base_url='/histories',
        doc_field_name='message',
    )
    q = search_fields.MultiMatchField(extra_fields=['table_name', 'action'])
    row_id = search_fields.FilterField(
        NumberTermSchema,
        doc_template='docs/generic/fields/number_term_field.html',
        doc_base_url='/histories',
        doc_field_name='row_id',
    )
    sort = search_fields.SortField(
        sort_fields={
            'id': 'id',
            'row_id': 'row_id',
            'table_name': 'table_name',
            'change_timestamp': 'change_timestamp',
            'change_user_id': 'change_user_id',
        },
        doc_base_url='/histories',
    )
    table_name = search_fields.FilterField(
        StringMatchSchema,
        doc_template='docs/generic/fields/string_match_field.html',
        doc_base_url='/histories',
        doc_field_name='table_name',
    )

    class Meta:
        strict = True
        ordered = True
Пример #2
0
class LogEntryApiSearchRequest(HistoryApiSearchRequest):
    action = search_fields.FilterField(
        StringMatchSchema,
        doc_template='docs/generic/fields/string_match_field.html',
        doc_base_url='/histories',
        doc_field_name='action',
        query_field='action_name',
    )
    q = search_fields.MultiMatchField(
        extra_fields=['table_name', 'action_name'])
Пример #3
0
class ApplicationApiSearchRequest(ListingSchema):
    id = search_fields.FilterField(
        NumberTermSchema,
        doc_template='docs/generic/fields/number_term_field.html',
        doc_base_url='/datasets',
        doc_field_name='ID')
    title = search_fields.FilterField(
        StringMatchSchema,
        doc_template='docs/generic/fields/string_match_field.html',
        doc_base_url='/datasets',
        doc_field_name='title',
        translated=True,
        search_path='title')
    notes = search_fields.FilterField(
        StringMatchSchema,
        doc_template='docs/generic/fields/string_match_field.html',
        doc_base_url='/datasets',
        doc_field_name='notes',
        translated=True,
        search_path='notes')

    tag = search_fields.FilterField(
        StringTermSchema,
        doc_template='docs/generic/fields/string_term_field.html',
        doc_base_url='/datasets',
        doc_field_name='tag',
        translated=True,
        search_path='tags',
        query_field='tags')

    q = search_fields.MultiMatchField(
        query_fields=['title^4', 'notes^2'],
        nested_query_fields={'datasets': [
            'title',
        ]})
    sort = search_fields.SortField(
        sort_fields={
            'id': 'id',
            'title': 'title.{lang}.sort',
            'modified': 'modified',
            'created': 'created'
        },
        doc_template='docs/generic/fields/sort_field.html',
        doc_base_url='/institutions',
        doc_field_name='sort')

    facet = search_fields.FacetField(ApplicationAggs)

    class Meta:
        strict = True
        ordered = True
class SearchHistoryApiSearchRequest(ListingSchema):
    id = search_fields.FilterField(
        NumberTermSchema,
        doc_template='docs/generic/fields/number_term_field.html',
        doc_base_url='/searchhistories',
        doc_field_name='ID',
    )
    url = search_fields.FilterField(
        StringMatchSchema,
        doc_template='docs/generic/fields/string_match_field.html',
        doc_base_url='/searchhistories',
        doc_field_name='url',
    )
    query_sentence = search_fields.FilterField(
        StringMatchSchema,
        doc_template='docs/generic/fields/string_match_field.html',
        doc_base_url='/searchhistories',
        doc_field_name='query_sentence',
    )
    modified = search_fields.FilterField(
        StringMatchSchema,
        query_field='modified',
        doc_template='docs/generic/fields/string_match_field.html',
        doc_base_url='/searchhistories',
        doc_field_name='modified',
    )
    q = search_fields.MultiMatchField(
        extra_fields=['query_sentence', 'url'],
        doc_template='docs/generic/fields/query_field.html',
        doc_base_url='/searchhistories',
        doc_field_name='q')
    sort = search_fields.SortField(
        sort_fields={
            'id': 'id',
            'query_sentence': 'query_sentence_keyword',
            'modified': 'modified',
            'user': '******',
        },
        doc_base_url='/searchhistories',
    )

    class Meta:
        strict = True
        ordered = True
class DatasetApiSearchRequest(ListingSchema):
    id = search_fields.FilterField(
        NumberTermSchema,
        doc_template='docs/generic/fields/number_term_field.html',
        doc_base_url='/datasets',
        doc_field_name='ID')
    title = search_fields.FilterField(
        StringMatchSchema,
        doc_template='docs/generic/fields/string_match_field.html',
        doc_base_url='/datasets',
        doc_field_name='title',
        translated=True,
        search_path='title')
    notes = search_fields.FilterField(
        StringMatchSchema,
        doc_template='docs/generic/fields/string_match_field.html',
        doc_base_url='/datasets',
        doc_field_name='notes',
        translated=True,
        search_path='notes')
    category = search_fields.FilterField(CategoryFilterSchema)
    categories = search_fields.FilterField(CategoriesFilterSchema)
    institution = search_fields.FilterField(InstitutionFilterSchema)
    application = search_fields.FilterField(ApplicationFilterSchema)
    tag = search_fields.FilterField(
        StringTermSchema,
        doc_template='docs/generic/fields/string_term_field.html',
        doc_base_url='/datasets',
        doc_field_name='tag',
        translated=True,
        search_path='tags',
        query_field='tags')
    keyword = search_fields.FilterField(
        StringTermSchema,
        doc_template='docs/generic/fields/string_term_field.html',
        doc_base_url='/datasets',
        doc_field_name='keyword',
        search_path='keywords',
        query_field='keywords.name',
        condition=Term(keywords__language=get_language),
        nested_search=True,
    )
    format = search_fields.FilterField(
        StringTermSchema,
        doc_template='docs/generic/fields/string_term_field.html',
        doc_base_url='/datasets',
        doc_field_name='format',
        query_field='formats')
    types = search_fields.FilterField(
        StringTermSchema,
        doc_template='docs/generic/fields/string_term_field.html',
        doc_base_url='/datasets',
        doc_field_name='types',
        query_field='types')
    openness_score = search_fields.FilterField(
        NumberTermSchema,
        doc_template='docs/generic/fields/number_term_field.html',
        doc_base_url='/datasets',
        doc_field_name='openness score',
        query_field='openness_scores',
    )
    resource = search_fields.FilterField(ResourceFilterSchema)
    visualization_types = search_fields.FilterField(
        ListTermsSchema,
        query_field='visualization_types',
        doc_template='docs/generic/fields/string_term_field.html',
        doc_base_url='/datasets',
        doc_field_name='visualization types')
    created = search_fields.FilterField(
        DateTermSchema,
        doc_template='docs/generic/fields/number_term_field.html',
        doc_base_url='/datasets',
        doc_field_name='created',
    )
    q = search_fields.MultiMatchField(
        query_fields={
            'title': ['title^4'],
            'notes': ['notes^2']
        },
        nested_query_fields={'resources': [
            'title',
        ]})
    sort = search_fields.SortField(
        sort_fields={
            'id': 'id',
            'title': 'title.{lang}.sort',
            'modified': 'modified',
            'created': 'created',
            'views_count': 'views_count',
            'verified': 'verified',
        },
        doc_base_url='/datasets',
        missing='id',
    )

    facet = search_fields.FacetField(DatasetAggregations)
    include = search_fields.StringField(
        data_key='include',
        description=
        'Allow the client to customize which related resources should be returned in included section.',
        allowEmptyValue=True,
    )

    class Meta:
        strict = True
        ordered = True
Пример #6
0
class ResourceApiSearchRequest(ListingSchema):
    id = search_fields.FilterField(NumberTermSchema,
                                   doc_template='docs/generic/fields/number_term_field.html',
                                   doc_base_url='/resources',
                                   doc_field_name='ID'
                                   )
    title = search_fields.FilterField(StringMatchSchema,
                                      doc_template='docs/generic/fields/string_match_field.html',
                                      doc_base_url='/resources',
                                      doc_field_name='title',
                                      translated=True,
                                      search_path='title'
                                      )
    description = search_fields.FilterField(StringMatchSchema,
                                            doc_template='docs/generic/fields/string_match_field.html',
                                            doc_base_url='/resources',
                                            doc_field_name='description',
                                            translated=True,
                                            search_path='description'
                                            )
    format = search_fields.FilterField(
        StringTermSchema,
        doc_template='docs/generic/fields/string_term_field.html',
        doc_base_url='/resources',
        doc_field_name='format'
    )
    media_type = search_fields.FilterField(
        StringTermSchema,
        doc_template='docs/generic/fields/string_term_field.html',
        doc_base_url='/resources',
        doc_field_name='media type'
    )
    openness_score = search_fields.FilterField(NumberTermSchema,
                                               doc_template='docs/resources/fields/openness_score.html',
                                               doc_base_url='/resources',
                                               doc_field_name='openness score'
                                               )
    q = search_fields.MultiMatchField(
        query_fields=['title^4', 'description^2'],
        nested_query_fields={'dataset': ['title', ]},
        doc_template='docs/generic/fields/query_field.html',
        doc_base_url='/resources',
        doc_field_name='q'
    )
    sort = search_fields.SortField(
        sort_fields={
            'id': 'id',
            'title': 'title.{lang}.raw',
            'modified': 'modified',
            'created': 'created',
            'verified': 'verified',
            'data_date': 'data_date',
        },
        doc_template='docs/generic/fields/sort_field.html',
        doc_base_url='/resources',
        doc_field_name='sort'
    )
    dataset = search_fields.FilterField(ResourceDatasetFilterField,
                                        doc_template='docs/resources/fields/dataset.html',
                                        doc_base_url='/resources',
                                        doc_field_name='dataset'
                                        )
    facet = search_fields.FacetField(ResourceAggregations)

    class Meta:
        strict = True
        ordered = True
Пример #7
0
class ApplicationApiSearchRequest(ListingSchema):
    id = search_fields.FilterField(
        NumberTermSchema,
        doc_template='docs/generic/fields/number_term_field.html',
        doc_base_url='/applications',
        doc_field_name='ID')
    title = search_fields.FilterField(
        StringMatchSchema,
        doc_template='docs/generic/fields/string_match_field.html',
        doc_base_url='/applications',
        doc_field_name='title',
        translated=True,
        search_path='title')
    notes = search_fields.FilterField(
        StringMatchSchema,
        doc_template='docs/generic/fields/string_match_field.html',
        doc_base_url='/applications',
        doc_field_name='notes',
        translated=True,
        search_path='notes')
    has_image_thumb = search_fields.TermsField()

    tag = search_fields.FilterField(
        StringTermSchema,
        doc_template='docs/generic/fields/string_term_field.html',
        doc_base_url='/applications',
        doc_field_name='tag',
        translated=True,
        search_path='tags',
        query_field='tags')

    keyword = search_fields.FilterField(
        StringTermSchema,
        doc_template='docs/generic/fields/string_term_field.html',
        doc_base_url='/applications',
        doc_field_name='keyword',
        search_path='keywords',
        query_field='keywords.name',
        condition=Term(keywords__language=get_language),
        nested_search=True,
    )

    q = search_fields.MultiMatchField(
        query_fields={
            'title': ['title^4'],
            'notes': ['notes^2']
        },
        nested_query_fields={'datasets': [
            'title',
        ]})
    sort = search_fields.SortField(
        sort_fields={
            'id': 'id',
            'title': 'title.{lang}.sort',
            'modified': 'modified',
            'created': 'created',
            'views_count': 'views_count',
            'main_page_position': 'main_page_position',
        },
        doc_base_url='/applications',
    )

    facet = search_fields.FacetField(ApplicationAggs)
    is_featured = search_fields.ExistsField("main_page_position")

    class Meta:
        strict = True
        ordered = True
Пример #8
0
class InstitutionApiSearchRequest(ListingSchema):
    id = search_fields.FilterField(NumberTermSchema,
                                   doc_template='docs/generic/fields/number_term_field.html',
                                   doc_base_url='/institutions',
                                   doc_field_name='ID'
                                   )
    slug = search_fields.FilterField(StringTermSchema,
                                     doc_template='docs/generic/fields/string_term_field.html',
                                     doc_base_url='/institutions',
                                     doc_field_name='slug',
                                     translated=True,
                                     search_path='slug'
                                     )
    city = search_fields.FilterField(StringTermSchema,
                                     doc_template='docs/generic/fields/string_term_field.html',
                                     doc_base_url='/institutions',
                                     doc_field_name='city'
                                     )
    regon = search_fields.FilterField(StringTermSchema,
                                      doc_template='docs/generic/fields/string_term_field.html',
                                      doc_base_url='/institutions',
                                      doc_field_name='regon'
                                      )
    street = search_fields.FilterField(StringTermSchema,
                                       doc_template='docs/generic/fields/string_term_field.html',
                                       doc_base_url='/institutions',
                                       doc_field_name='street'
                                       )
    postal_code = search_fields.FilterField(StringTermSchema,
                                            doc_template='docs/generic/fields/string_term_field.html',
                                            doc_base_url='/institutions',
                                            doc_field_name='postal code'
                                            )

    email = search_fields.FilterField(StringTermSchema,
                                      doc_template='docs/generic/fields/string_term_field.html',
                                      doc_base_url='/institutions',
                                      doc_field_name='email address'
                                      )
    org_type = search_fields.FilterField(StringTermSchema,
                                         data_key='type',
                                         query_field='institution_type',
                                         doc_template='docs/generic/fields/string_term_field.html',
                                         doc_base_url='/institutions',
                                         doc_field_name='type'
                                         )
    tel = search_fields.FilterField(StringTermSchema,
                                    doc_template='docs/generic/fields/string_term_field.html',
                                    doc_base_url='/institutions',
                                    doc_field_name='tel',
                                    )
    fax = search_fields.FilterField(StringTermSchema,
                                    doc_template='docs/generic/fields/string_term_field.html',
                                    doc_base_url='/institutions',
                                    doc_field_name='fax'
                                    )
    website = search_fields.FilterField(StringTermSchema,
                                        doc_template='docs/generic/fields/string_term_field.html',
                                        doc_base_url='/institutions',
                                        doc_field_name='website'
                                        )

    title = search_fields.FilterField(StringMatchSchema,
                                      doc_template='docs/generic/fields/string_match_field.html',
                                      doc_base_url='/institutions',
                                      doc_field_name='title',
                                      translated=True,
                                      search_path='title'

                                      )
    description = search_fields.FilterField(StringMatchSchema,
                                            doc_template='docs/generic/fields/string_match_field.html',
                                            doc_base_url='/institutions',
                                            doc_field_name='description',
                                            translated=True,
                                            search_path='title'
                                            )

    q = search_fields.MultiMatchField(
        query_fields={'title': ['title^4'], 'description': ['description^2']},
        nested_query_fields={'datasets': ['title', ]},
        doc_template='docs/generic/fields/query_field.html',
        doc_base_url='/institutions',
        doc_field_name='q'
    )
    sort = search_fields.SortField(
        sort_fields={
            'id': 'id',
            'title': 'title.{lang}.sort',
            "city": "city.{lang}",
            'modified': 'modified',
            'created': 'created'
        },
        doc_base_url='/institutions',
    )
    facet = search_fields.FacetField(InstitutionApiAggregations)
    include = search_fields.StringField(
        data_key='include',
        description='Allow the client to customize which related resources should be returned in included section.',
        allowEmptyValue=True,
    )

    class Meta:
        strict = True
        ordered = True
class ResourceApiSearchRequest(ListingSchema):
    id = search_fields.FilterField(
        NumberTermSchema,
        doc_template='docs/generic/fields/number_term_field.html',
        doc_base_url='/resources',
        doc_field_name='ID')
    title = search_fields.FilterField(
        StringMatchSchema,
        doc_template='docs/generic/fields/string_match_field.html',
        doc_base_url='/resources',
        doc_field_name='title',
        translated=True,
        search_path='title')
    description = search_fields.FilterField(
        StringMatchSchema,
        doc_template='docs/generic/fields/string_match_field.html',
        doc_base_url='/resources',
        doc_field_name='description',
        translated=True,
        search_path='description')
    format = search_fields.FilterField(
        StringTermSchema,
        doc_template='docs/generic/fields/string_term_field.html',
        doc_base_url='/resources',
        doc_field_name='format')
    media_type = search_fields.FilterField(
        StringTermSchema,
        query_field='type',
        doc_template='docs/generic/fields/string_term_field.html',
        doc_base_url='/resources',
        doc_field_name='media type')
    type = search_fields.FilterField(
        StringTermSchema,
        query_field='type',
        doc_template='docs/generic/fields/string_term_field.html',
        doc_base_url='/resources',
        doc_field_name='type')
    visualization_type = search_fields.FilterField(
        ListTermsSchema,
        query_field='visualization_types',
        doc_template='docs/generic/fields/string_term_field.html',
        doc_base_url='/resources',
        doc_field_name='visualization type')
    openness_score = search_fields.FilterField(
        NumberTermSchema,
        doc_template='docs/resources/fields/openness_score.html',
        doc_base_url='/resources',
        doc_field_name='openness score')
    created = search_fields.FilterField(
        DateTermSchema,
        doc_template='docs/generic/fields/number_term_field.html',
        doc_base_url='/resources',
        doc_field_name='created')
    q = search_fields.MultiMatchField(
        query_fields={
            'title': ['title^4'],
            'description': ['description^2']
        },
        nested_query_fields={'dataset': [
            'title',
        ]},
        doc_template='docs/generic/fields/query_field.html',
        doc_base_url='/resources',
        doc_field_name='q')
    sort = search_fields.SortField(
        sort_fields={
            'id': 'id',
            'title': 'title.{lang}.raw',
            'modified': 'modified',
            'created': 'created',
            'verified': 'verified',
            'data_date': 'data_date',
            'views_count': 'views_count',
        },
        doc_base_url='/resources',
    )
    dataset = search_fields.FilterField(
        ResourceDatasetFilterField,
        doc_template='docs/resources/fields/dataset.html',
        doc_base_url='/resources',
        doc_field_name='dataset')
    facet = search_fields.FacetField(ResourceAggregations)
    include = search_fields.StringField(
        data_key='include',
        description=
        'Allow the client to customize which related resources should be returned in included section.',
        allowEmptyValue=True,
    )

    class Meta:
        strict = True
        ordered = True
Пример #10
0
class DatasetApiSearchRequest(ListingSchema):
    id = search_fields.FilterField(
        NumberTermSchema,
        doc_template='docs/generic/fields/number_term_field.html',
        doc_base_url='/datasets',
        doc_field_name='ID')
    title = search_fields.FilterField(
        StringMatchSchema,
        doc_template='docs/generic/fields/string_match_field.html',
        doc_base_url='/datasets',
        doc_field_name='title',
        translated=True,
        search_path='title')
    notes = search_fields.FilterField(
        StringMatchSchema,
        doc_template='docs/generic/fields/string_match_field.html',
        doc_base_url='/datasets',
        doc_field_name='notes',
        translated=True,
        search_path='notes')
    category = search_fields.FilterField(CategoryFilterSchema)
    institution = search_fields.FilterField(InstitutionFilterSchema)
    tag = search_fields.FilterField(
        StringTermSchema,
        doc_template='docs/generic/fields/string_term_field.html',
        doc_base_url='/datasets',
        doc_field_name='tag',
        translated=True,
        search_path='tags',
        query_field='tags')
    format = search_fields.FilterField(
        StringTermSchema,
        doc_template='docs/generic/fields/string_term_field.html',
        doc_base_url='/datasets',
        doc_field_name='format',
        query_field='formats')
    openness_score = search_fields.FilterField(
        NumberTermSchema,
        doc_template='docs/generic/fields/number_term_field.html',
        doc_base_url='/datasets',
        doc_field_name='openness score')
    resource = search_fields.FilterField(ResourceFilterSchema)

    q = search_fields.MultiMatchField(
        query_fields=['title^4', 'notes^2'],
        nested_query_fields={'resources': [
            'title',
        ]})
    sort = search_fields.SortField(
        sort_fields={
            'id': 'id',
            'title': 'title.{lang}.sort',
            'modified': 'modified',
            'created': 'created',
            'verified': 'verified',
        },
        doc_template='docs/generic/fields/sort_field.html',
        doc_base_url='/institutions',
        doc_field_name='sort')

    facet = search_fields.FacetField(DatasetAggregations)

    class Meta:
        strict = True
        ordered = True
Пример #11
0
class InstitutionApiSearchRequest(ListingSchema):
    id = search_fields.FilterField(
        NumberTermSchema,
        doc_template='docs/generic/fields/number_term_field.html',
        doc_base_url='/institutions',
        doc_field_name='ID')
    slug = search_fields.FilterField(
        StringTermSchema,
        doc_template='docs/generic/fields/string_term_field.html',
        doc_base_url='/institutions',
        doc_field_name='slug',
        translated=True,
        search_path='slug')
    city = search_fields.FilterField(
        StringTermSchema,
        doc_template='docs/generic/fields/string_term_field.html',
        doc_base_url='/institutions',
        doc_field_name='city')
    regon = search_fields.FilterField(
        StringTermSchema,
        doc_template='docs/generic/fields/string_term_field.html',
        doc_base_url='/institutions',
        doc_field_name='regon')
    street = search_fields.FilterField(
        StringTermSchema,
        doc_template='docs/generic/fields/string_term_field.html',
        doc_base_url='/institutions',
        doc_field_name='street')
    postal_code = search_fields.FilterField(
        StringTermSchema,
        doc_template='docs/generic/fields/string_term_field.html',
        doc_base_url='/institutions',
        doc_field_name='postal code')

    email = search_fields.FilterField(
        StringTermSchema,
        doc_template='docs/generic/fields/string_term_field.html',
        doc_base_url='/institutions',
        doc_field_name='email address')
    org_type = search_fields.FilterField(
        StringTermSchema,
        data_key='type',
        doc_template='docs/generic/fields/string_term_field.html',
        doc_base_url='/institutions',
        doc_field_name='type')
    tel = search_fields.FilterField(
        StringTermSchema,
        doc_template='docs/generic/fields/string_term_field.html',
        doc_base_url='/institutions',
        doc_field_name='tel')
    fax = search_fields.FilterField(
        StringTermSchema,
        doc_template='docs/generic/fields/string_term_field.html',
        doc_base_url='/institutions',
        doc_field_name='fax')
    website = search_fields.FilterField(
        StringTermSchema,
        doc_template='docs/generic/fields/string_term_field.html',
        doc_base_url='/institutions',
        doc_field_name='website')

    title = search_fields.FilterField(
        StringMatchSchema,
        doc_template='docs/generic/fields/string_match_field.html',
        doc_base_url='/institutions',
        doc_field_name='title',
        translated=True,
        search_path='title')
    description = search_fields.FilterField(
        StringMatchSchema,
        doc_template='docs/generic/fields/string_match_field.html',
        doc_base_url='/institutions',
        doc_field_name='description',
        translated=True,
        search_path='title')

    q = search_fields.MultiMatchField(
        query_fields=['title^4', 'description^2'],
        nested_query_fields={'datasets': [
            'title',
        ]},
        doc_template='docs/generic/fields/query_field.html',
        doc_base_url='/institutions',
        doc_field_name='q')
    sort = search_fields.SortField(
        sort_fields={
            'id': 'id',
            'title': 'title.{lang}.sort',
            "city": "city.{lang}",
            'modified': 'modified',
            'created': 'created'
        },
        doc_template='docs/generic/fields/sort_field.html',
        doc_base_url='/institutions',
        doc_field_name='sort')
    facet = search_fields.FacetField(InstitutionApiAggregations)

    class Meta:
        strict = True
        ordered = True