Package de.cxp.ocs.controller
Class UpdateIndexController
java.lang.Object
de.cxp.ocs.controller.UpdateIndexController
- All Implemented Interfaces:
UpdateIndexService
@RestController
@RequestMapping(path="/indexer-api/v1/update/{indexName}")
public class UpdateIndexController
extends Object
implements UpdateIndexService
-
Nested Class Summary
Nested classes/interfaces inherited from interface de.cxp.ocs.api.indexer.UpdateIndexService
UpdateIndexService.Result
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondeleteDocuments
(String indexName, List<String> ids) Delete existing document.patchDocuments
(String indexName, List<Document> documents) Partial update of an existing document.Puts a document to the index.
-
Constructor Details
-
UpdateIndexController
public UpdateIndexController()
-
-
Method Details
-
patchDocuments
@PatchMapping public Map<String,UpdateIndexService.Result> patchDocuments(@PathVariable("indexName") String indexName, @RequestBody 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 interfaceUpdateIndexService
- Parameters:
indexName
- name of the index that should receive that updatedocuments
- Full or partial document that carries the data for the update- Returns:
- Result code, one of UPDATED, NOT_FOUND, NOOP, DISMISSED
-
putDocuments
@PutMapping public Map<String,UpdateIndexService.Result> putDocuments(@PathVariable("indexName") String indexName, @RequestParam(name="replaceExisting",defaultValue="true") Boolean replaceExisting, @RequestParam(name="langCode",defaultValue="",required=false) String langCode, @RequestBody 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 interfaceUpdateIndexService
- Parameters:
indexName
- name of the index that should receive that updatereplaceExisting
- 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
-
deleteDocuments
@DeleteMapping public Map<String,UpdateIndexService.Result> deleteDocuments(@PathVariable("indexName") String indexName, @RequestParam("id") List<String> ids) Description copied from interface:UpdateIndexService
Delete existing document. If document does not exist, it returns code 404.- Specified by:
deleteDocuments
in interfaceUpdateIndexService
- Parameters:
indexName
- name of the index that should receive that updateids
- Array of IDs of the documents that should be deleted- Returns:
- Result code, one of DELETED, NOT_FOUND
-