Fix thesaurus regression from f25bdf4171

- Field class is now immutable, mergeWith() returns a new instance
- Thesaurus roots are recursively merged
- In case of field merge, Structure class do not index the previous field
- Added failing test case for previous bugs
- Added merge tests on Field class
- Added tests for all indexed stuff inside Structure class
This commit is contained in:
Mathieu Darse
2015-06-19 21:17:01 +02:00
parent 1dd4bc5c5f
commit a74d0cd7bd
6 changed files with 291 additions and 40 deletions

View File

@@ -12,7 +12,6 @@ class Structure
private $thesaurus_fields = array();
private $private = array();
private $facets = array();
private $aliases = array();
/**
* @param \databox[] $databoxes
@@ -34,10 +33,9 @@ class Structure
{
$name = $field->getName();
if (isset($this->fields[$name])) {
$this->fields[$name]->mergeWith($field);
} else {
$this->fields[$name] = $field;
$field = $this->fields[$name]->mergeWith($field);
}
$this->fields[$name] = $field;
if ($field->getType() === Mapping::TYPE_DATE) {
$this->date_fields[$name] = $field;