beat.web.search.api module

class beat.web.search.api.SearchView(**kwargs)[source]

Bases: rest_framework.views.APIView

Search endpoint

This view allows to run a search through the various elements composing the beat platform either using a query which will run a global search or by using filters that will restrict the search to the given domains.

Available filters are: ‘results’, ‘toolchains’, ‘algorithms’, ‘dataformats’, ‘databases’, ‘users’ Available options are: ‘order-by’

permission_classes = [<class 'rest_framework.permissions.AllowAny'>]
FILTER_IEXACT = 0
FILTER_ICONTAINS = 1
FILTER_ISTARTSWITH = 2
FILTER_IENDSWITH = 3
static build_name_and_description_query(keywords)[source]
post(request)[source]
class beat.web.search.api.SearchSaveView(**kwargs)[source]

Bases: beat.web.common.mixins.CommonContextMixin, beat.web.common.mixins.SerializerFieldsMixin, rest_framework.generics.CreateAPIView, rest_framework.generics.UpdateAPIView

This endpoint allows to save and update a search query

Saving a search allows to re-run the same query later without having to redo the query/filtering which might get complex.

Note that two consecutive runs of a search might yield different results

model

alias of beat.web.search.models.Search

permission_classes = [<class 'rest_framework.permissions.IsAuthenticated'>]
serializer_class

alias of beat.web.search.serializers.SearchWriteSerializer

build_results(request, search)[source]
post(request)[source]
put(request, author_name, name)[source]
class beat.web.search.api.ListSearchView(**kwargs)[source]

Bases: beat.web.common.mixins.CommonContextMixin, rest_framework.generics.ListAPIView

Lists all available search from a user

permission_classes = [<class 'rest_framework.permissions.AllowAny'>]
serializer_class

alias of beat.web.search.serializers.SearchSerializer

get_queryset()[source]

Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

You may want to override this if you need to provide different querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)

class beat.web.search.api.RetrieveDestroySearchAPIView(**kwargs)[source]

Bases: beat.web.common.mixins.CommonContextMixin, beat.web.common.mixins.SerializerFieldsMixin, rest_framework.generics.RetrieveDestroyAPIView

Delete the given search

model

alias of beat.web.search.models.Search

serializer_class

alias of beat.web.search.serializers.SearchSerializer

permission_classes = [<class 'beat.web.common.permissions.IsAuthorOrReadOnly'>]
get_object()[source]

Returns the object the view is displaying.

You may want to override this if you need to provide non-standard queryset lookups. Eg if objects are referenced using multiple keyword arguments in the url conf.

get(request, *args, **kwargs)[source]
class beat.web.search.api.ShareSearchView(**kwargs)[source]

Bases: beat.web.common.api.ShareView

Share the given search with other users/teams

model

alias of beat.web.search.models.Search

permission_classes = [<class 'rest_framework.permissions.AllowAny'>]
get_queryset()[source]

Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.

This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.

You may want to override this if you need to provide different querysets depending on the incoming request.

(Eg. return a list of items that is specific to the user)