Ejemplo n.º 1
0
    def with_retries(self, func, *args, **kwargs):
        """
        This function performs the passed function with the given args and kwargs and reconnect if it fails

        :return: return the output of the function passed
        """
        raise UndefinedFunction("This is the basic datastore object, none of the methods are defined.")
Ejemplo n.º 2
0
    def search(self, query, offset=0, rows=DEFAULT_ROW_SIZE, sort=None, fl=None, timeout=None,
               filters=(), access_control=None, deep_paging_id=None, as_obj=True, use_archive=True,
               track_total_hits=False):
        """
        This function should perform a search through the datastore and return a
        search result object that consist on the following::

            {
                "offset": 0,      # Offset in the search index
                "rows": 25,       # Number of document returned per page
                "total": 123456,  # Total number of documents matching the query
                "items": [        # List of dictionary where each keys are one of
                    {             #   the field list parameter specified
                        fl[0]: value,
                        ...
                        fl[x]: value
                    }, ...]
            }

        :param track_total_hits: Return to total matching document count
        :param use_archive: Query also the archive
        :param deep_paging_id: ID of the next page during deep paging searches
        :param as_obj: Return objects instead of dictionaries
        :param query: lucene query to search for
        :param offset: offset at which you want the results to start at (paging)
        :param rows: number of items that the search function should return
        :param sort: field to sort the data with
        :param fl: list of fields to return from the search
        :param timeout: maximum time of execution
        :param filters: additional queries to run on the original query to reduce the scope
        :param access_control: access control parameters to limiti the scope of the query
        :return: a search result object
        """
        raise UndefinedFunction("This is the basic collection object, none of the methods are defined.")
Ejemplo n.º 3
0
    def stream_search(self,
                      query,
                      fl=None,
                      filters=(),
                      access_control=None,
                      buffer_size=200,
                      as_obj=True,
                      use_archive=True):
        """
        This function should perform a search through the datastore and stream
        all related results as a dictionary of key value pair where each keys
        are one of the field specified in the field list parameter.

        >>> # noinspection PyUnresolvedReferences
        >>> {
        >>>     fl[0]: value,
        >>>     ...
        >>>     fl[x]: value
        >>> }

        :param use_archive: Query also the archive
        :param as_obj: Return objects instead of dictionaries
        :param query: lucene query to search for
        :param fl: list of fields to return from the search
        :param filters: additional queries to run on the original query to reduce the scope
        :param access_control: access control parameters to run the query with
        :param buffer_size: number of items to buffer with each search call
        :return: a generator of dictionary of field list results
        """
        raise UndefinedFunction(
            "This is the basic collection object, none of the methods are defined."
        )
Ejemplo n.º 4
0
    def fields(self):
        """
        This function should return all the fields in the index with their types

        :return:
        """
        raise UndefinedFunction("This is the basic collection object, none of the methods are defined.")
Ejemplo n.º 5
0
    def _ensure_collection(self):
        """
        This function should test if the collection that you are trying to access does indeed exist
        and should create it if it does not.

        :return:
        """
        raise UndefinedFunction("This is the basic collection object, none of the methods are defined.")
Ejemplo n.º 6
0
    def reindex(self):
        """
        This function should be overloaded to perform a reindex of all the data of the different hosts
        specified in self.datastore.hosts.

        :return: Should return True of the commit was successful on all hosts
        """
        raise UndefinedFunction("This is the basic datastore object, none of the methods are defined.")
Ejemplo n.º 7
0
    def archive(self, query):
        """
        This function should archive to document that are matching to query to an time splitted index

        :param query: query to run to archive documents
        :return: Number of archived documents
        """
        raise UndefinedFunction("This is the basic collection object, none of the methods are defined.")
Ejemplo n.º 8
0
    def _bulk(self, operations):
        """
        This function should be overloaded to perform a bulk operations on the datastore.

        :return: Results of the bulk operation
        """

        raise UndefinedFunction("This is the basic datastore object, none of the methods are defined.")
Ejemplo n.º 9
0
    def delete(self, key):
        """
        This function should delete the underlying document referenced by the key.
        It should return true if the document was in fact properly deleted.

        :param key: id of the document to delete
        :return: True is delete successful
        """
        raise UndefinedFunction("This is the basic collection object, none of the methods are defined.")
Ejemplo n.º 10
0
    def wipe(self):
        """
        This function should completely delete the collection

        NEVER USE THIS!

        :return:
        """
        raise UndefinedFunction("This is the basic collection object, none of the methods are defined.")
Ejemplo n.º 11
0
 def stats(self,
           field,
           query="id:*",
           filters=None,
           access_control=None,
           use_archive=True):
     raise UndefinedFunction(
         "This is the basic collection object, none of the methods are defined."
     )
Ejemplo n.º 12
0
    def delete_matching(self, query, workers=20):
        """
        This function should delete the underlying documents referenced by the query.
        It should return true if the documents were in fact properly deleted.

        :param query: Query of the documents to download
        :param workers: Number of workers used for deletion if basic currency delete is used
        :return: True is delete successful
        """
        raise UndefinedFunction("This is the basic collection object, none of the methods are defined.")
Ejemplo n.º 13
0
    def _get(self, key, retries):
        """
        This function should be overloaded in a way that if the document is not found,
        the function retries to get the document the specified amount of time.

        retries = -1 means that we will retry forever.

        :param key: key of the document to get from the datastore
        :param retries: number of time to retry if the document can't be found
        :return: The document strait of the datastore
        """
        raise UndefinedFunction("This is the basic collection object, none of the methods are defined.")
Ejemplo n.º 14
0
    def _save(self, key, data):
        """
        This function should takes in an instance of the the model class as input
        and saves it to the database backend at the id mentioned by the key.

        This function should return True if the data was saved correctly

        :param key: key to use to store the document
        :param data: instance of the model class to save to the database
        :return: True if save was successful
        """
        raise UndefinedFunction("This is the basic collection object, none of the methods are defined.")
Ejemplo n.º 15
0
 def histogram(self,
               field,
               start,
               end,
               gap,
               query="id:*",
               mincount=1,
               filters=None,
               access_control=None,
               use_archive=True):
     raise UndefinedFunction(
         "This is the basic collection object, none of the methods are defined."
     )
Ejemplo n.º 16
0
 def facet(self,
           field,
           query="id:*",
           prefix=None,
           contains=None,
           ignore_case=False,
           sort=None,
           limit=10,
           mincount=1,
           filters=None,
           access_control=None,
           use_archive=True):
     raise UndefinedFunction(
         "This is the basic collection object, none of the methods are defined."
     )
Ejemplo n.º 17
0
 def grouped_search(self,
                    group_field,
                    query="id:*",
                    offset=None,
                    sort=None,
                    group_sort=None,
                    fl=None,
                    limit=None,
                    rows=DEFAULT_ROW_SIZE,
                    filters=(),
                    access_control=None,
                    as_obj=True,
                    use_archive=True):
     raise UndefinedFunction(
         "This is the basic collection object, none of the methods are defined."
     )
Ejemplo n.º 18
0
 def ping(self):
     raise UndefinedFunction(
         "This is the basic datastore object, ping method is undefined.")
Ejemplo n.º 19
0
 def connection_reset(self):
     raise UndefinedFunction(
         "This is the basic datastore object, connection_reset method is undefined."
     )
Ejemplo n.º 20
0
 def get_plan_data(self):
     raise UndefinedFunction(
         "This is the basic BulkPlan object, none of the methods are defined."
     )
Ejemplo n.º 21
0
 def add_update_operation(self, doc_id, doc, index=None):
     raise UndefinedFunction(
         "This is the basic BulkPlan object, none of the methods are defined."
     )
Ejemplo n.º 22
0
 def add_insert_operation(self, doc_id, doc):
     raise UndefinedFunction("This is the basic BulkPlan object, none of the methods are defined.")