Class AbstractIndexer

    • Method Detail

      • startImport

        public ImportSession startImport​(String indexName,
                                         String locale)
                                  throws IllegalStateException
        Description copied from interface: FullIndexationService
        Start a new full import. Returns a handle containing meta data, that has to be passed to all following calls.
        Specified by:
        startImport in interface FullIndexationService
        Parameters:
        indexName - index name, that should match the regular expression '[a-z0-9_-]+'
        locale - used for language dependent settings
        Returns:
        ImportSession that should be used for follow up requests to add data to that new index
        Throws:
        IllegalStateException - in case there is already a full-import running for that index.
      • isImportRunning

        public abstract boolean isImportRunning​(String indexName)
      • add

        public int add​(BulkImportData data)
                throws Exception
        Description copied from interface: FullIndexationService
        Add one or more documents to a running import session.
        Specified by:
        add in interface FullIndexationService
        Parameters:
        data - bulk data which consist of the ImportSession and one or more products that should be added to that index.
        Returns:
        the amount of documents that were successfully added to the index
        Throws:
        Exception - in case import session is invalid
      • done

        public boolean done​(ImportSession session)
                     throws Exception
        Description copied from interface: FullIndexationService
        Finishes the import, flushing the new index and (in case there is already an index with the initialized name) replacing the old one.
        Specified by:
        done in interface FullIndexationService
        Parameters:
        session - ImportSession that should be closed.
        Returns:
        true on success, otherwise false
        Throws:
        Exception - if import session is invalid
      • deploy

        protected abstract boolean deploy​(ImportSession session)
      • cancel

        public void cancel​(ImportSession session)
        Description copied from interface: FullIndexationService
        Cancels import which results in a deletion of the temporary index.
        Specified by:
        cancel in interface FullIndexationService
        Parameters:
        session - ImportSession that contains the information, which index should be dropped.
      • deleteIndex

        protected abstract void deleteIndex​(String indexName)
      • _get

        protected abstract Document _get​(@NonNull
                                         @NonNull String indexName,
                                         @NonNull
                                         @NonNull String docId)
      • patchDocuments

        public Map<String,​UpdateIndexService.Result> patchDocuments​(String indexName,
                                                                          List<Document> documents)
        Description copied from interface: UpdateIndexService

        Partial update of an existing document. If the document does not exist, no update will be performed and status 404 is returned.

        In case the document is a master product with variants, the provided master product may only contain the changed values. However if some data at the product variants are updated, all data from all variant products are required, otherwise missing variants won't be there after the update!

        Specified by:
        patchDocuments in interface UpdateIndexService
        Parameters:
        indexName - name of the index that should receive that update
        documents - Full or partial document that carries the data for the update
        Returns:
        Result code, one of UPDATED, NOT_FOUND, NOOP, DISMISSED
      • putDocuments

        public Map<String,​UpdateIndexService.Result> putDocuments​(String indexName,
                                                                        Boolean replaceExisting,
                                                                        List<Document> documents)
        Description copied from interface: UpdateIndexService

        Puts a document to the index. If document does not exist, it will be added.

        An existing product will be overwritten unless the parameter "replaceExisting" is set to "false".

        Provided document should be a complete object, partial updates should be done using the updateDocument method.

        Specified by:
        putDocuments in interface UpdateIndexService
        Parameters:
        indexName - name of the index that should receive that update
        replaceExisting - set to false to avoid overriding a document with that ID. Defaults to 'true'
        documents - The documents that should be added or updated at the index.
        Returns:
        Result code, one of CREATED, UPDATED, NOOP, DISMISSED