protected function createDocument($data = array())
    {
        $enginePage = $this->getServiceLocator()->get('MelisEngineTree');
        $translator = $this->getServiceLocator()->get('translator');
        $pageSvc    = $this->getServiceLocator()->get('MelisEnginePage');
        $doc = new Document();
        if(is_array($data)) {
            $uri = $enginePage->getPageLink($data['page_id'], true);
            $pattern = '/(http|https)\:\/\/(www\.)?[a-zA-Z0-9-_.]+(\.([a-z.])?)*/';
            $domain = $this->getCurrentDomain();
            if($domain === '/'){
             echo  getenv('MELIS_PLATFORM') . " configuration is incorrect or does not exists in db";
             die;
           }
            if(!preg_match($pattern, $uri)) {
                $uri = $domain . $uri;
            }

            #$pageContent = $this->getUrlContent($uri) -- old ;

            $pageId = $data['page_id'] ?? null;
            $pageData  = $pageSvc->getDatasPage($pageId);
            $melisPageTree  = $pageData->getMelisPageTree();
            $pageContent = $melisPageTree->page_content;

            if($pageContent) {

                $doc->addField(Document\Field::Text('description', $enginePage->cleanString($this->getHtmlDescription($pageContent))));
                $doc->addField(Document\Field::Keyword('url', $uri));
                $doc->addField(Document\Field::Keyword('page_id', $data['page_id']));
                $doc->addField(Document\Field::Keyword('page_name', $data['page_name']));
                $doc->addField(Document\Field::UnStored('contents', $pageContent));


                $this->tmpLogs .= 'OK ' . sprintf($translator->translate('tr_melis_engine_search_create_index'), $data['page_id']) . sprintf($translator->translate('tr_melis_engine_search_create_index_success'), $uri) . PHP_EOL . '<br/>';
            }
            else {
                $this->tmpLogs .= 'KO ' . sprintf($translator->translate('tr_melis_engine_search_create_index'), $data['page_id']) . $translator->translate('tr_melis_engine_search_create_index_fail_unreachable') . ', ' . $uri . PHP_EOL . '<br/>';
                $this->unreachableCount++;
            }

        }

        return $doc;

    }