PHRAS-1260_INDEX-WIDTH-HEIGHT

- new : added with & height of document to es
This commit is contained in:
Jean-Yves Gaulier
2016-11-02 17:29:20 +01:00
parent 41be6154ed
commit 68ab86d9d4
3 changed files with 8 additions and 1 deletions

View File

@@ -51,6 +51,8 @@ class ElasticsearchRecordHydrator
$record->setOriginalName(igorw\get_in($data, ['original_name'], ''));
$record->setRecordId(igorw\get_in($data, ['record_id'], 0));
$record->setSha256(igorw\get_in($data, ['sha256'], ''));
$record->setWidth(igorw\get_in($data, ['width'], 0));
$record->setHeight(igorw\get_in($data, ['height'], 0));
$record->setType(igorw\get_in($data, ['type'], 'unknown'));
$updatedOn = igorw\get_in($data, ['updated_on']);
$record->setUpdated($updatedOn ? new \DateTime($updatedOn) : $updatedOn);

View File

@@ -132,7 +132,9 @@ class Fetcher
. ", r.sha256" // -- TODO rename in "hash"
. ", r.originalname AS original_name"
. ", r.mime, r.type, r.parent_record_id, r.credate AS created_on, r.moddate AS updated_on"
. " FROM record r INNER JOIN coll c ON (c.coll_id = r.coll_id)"
. ", subdef.width, subdef.height"
. " FROM (record r INNER JOIN coll c ON (c.coll_id = r.coll_id))"
. " LEFT JOIN subdef ON subdef.record_id=r.record_id AND subdef.name='document'"
. " -- WHERE"
. " ORDER BY r.record_id DESC"
. " LIMIT :offset, :limit";

View File

@@ -66,6 +66,9 @@ class RecordIndex implements MappingProvider
$mapping->addStringField('type')->disableAnalysis();
$mapping->addStringField('record_type')->disableAnalysis();
$mapping->addIntegerField('width')->disableIndexing();
$mapping->addIntegerField('height')->disableIndexing();
$mapping->addDateField('created_on', FieldMapping::DATE_FORMAT_MYSQL_OR_CAPTION);
$mapping->addDateField('updated_on', FieldMapping::DATE_FORMAT_MYSQL_OR_CAPTION);