From d5a9c5da0e923a4971df7e8abe6a8c5ba7ce8a3c Mon Sep 17 00:00:00 2001 From: Florian Meyer Date: Wed, 12 Apr 2017 10:19:57 +0200 Subject: [PATCH] Support indexing of files --- Model/Document.php | 1 + Services/SearchService.php | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Model/Document.php b/Model/Document.php index 97574a2..d5d0558 100644 --- a/Model/Document.php +++ b/Model/Document.php @@ -26,5 +26,6 @@ public static function createFromSolariumResult(DocumentInterface $solrDocument) $document->setEntityId($document->getFieldValue('internalId')); return $document; } + } diff --git a/Services/SearchService.php b/Services/SearchService.php index a5499d0..7f0869e 100644 --- a/Services/SearchService.php +++ b/Services/SearchService.php @@ -70,7 +70,7 @@ public function ping() { // create a ping query $ping = $client->createPing(); try { - $result = $client->ping($ping); + $client->ping($ping); return true; } catch(\Exception $e) { return false; @@ -104,6 +104,23 @@ public function saveDocument(\StingerSoft\EntitySearchBundle\Model\Document $doc // create a new document for the data $doc = $update->createDocument(); + + if(false) { + $filename = $document->getFile(); + if(!file_exists($filename)) { + //$this->logger->error('Can\' find file ' . $filename); + return; + } + $query = $this->client->createExtract(); + $doc = $query->createDocument(); + + $query->setUprefix('attr_'); + $query->setFile($filename); + $query->setCommit(true); + $query->setOmitHeader(true); + } + + $doc->id = $this->createIdFromDocument($document); $doc->internalId = json_encode($document->getEntityId()); $doc->clazz = $document->getEntityClass();