buildSearchIndex example

public function buildSearchIndexAction()
    {
        $total = (int) $this->Request()->getParam('total');
        $iteration = (int) $this->Request()->getParam('iteration', 1);
        $lastId = (int) $this->Request()->getParam('lastId');

        $offset = ($iteration - 1) * CustomerStreamRepository::INDEXING_LIMIT;
        $handled = $offset + CustomerStreamRepository::INDEXING_LIMIT;

        $full = $this->Request()->getParam('full');

        $ids = $this->getApiResource()->buildSearchIndex($lastId$full);

        $snippets = $this->container->get('snippets')->getNamespace('backend/customer/view/main');

        if ($handled >= $total) {
            $this->getApiResource()->cleanupIndexSearchIndex();

            $this->View()->assign([
                'success' => true,
                'finish' => true,
                'progress' => 1,
                'text' => $snippets->get('customer_refreshed'),
            ]);


    /** * POST /api/customer_streams * POST /api/customer_streams?buildSearchIndex=1 */
    public function postAction(): void
    {
        $request = $this->Request();

        if ($request->has('buildSearchIndex')) {
            $this->resource->buildSearchIndex(0, true);
            $this->resource->cleanupIndexSearchIndex();
            $this->View()->assign(['success' => true]);

            return;
        }

        $stream = $this->resource->create(
            $request->getPost(),
            $request->getParam('indexStream')
        );

        
Home | Imprint | This part of the site doesn't use cookies.