Skip to content

Commit

Permalink
Support indexing of files
Browse files Browse the repository at this point in the history
  • Loading branch information
Viburnum committed Apr 12, 2017
1 parent ed6e4b5 commit d5a9c5d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions Model/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ public static function createFromSolariumResult(DocumentInterface $solrDocument)
$document->setEntityId($document->getFieldValue('internalId'));
return $document;
}

}

19 changes: 18 additions & 1 deletion Services/SearchService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit d5a9c5d

Please sign in to comment.