diff --git a/lib/classes/caption/field.class.php b/lib/classes/caption/field.class.php index 5cf9917ae2..d15d4cb1d8 100644 --- a/lib/classes/caption/field.class.php +++ b/lib/classes/caption/field.class.php @@ -346,9 +346,9 @@ class caption_field implements cache_cacheableInterface if ($this->databox_field->is_multi() === true) { if ($as_string === true && $custom_separator === false) - + { return $this->value; - + } $separator = $this->databox_field->get_separator(); $array_values = self::get_multi_values($this->value, $separator); diff --git a/lib/classes/caption/record.class.php b/lib/classes/caption/record.class.php index fd608c404f..c5073e43f2 100644 --- a/lib/classes/caption/record.class.php +++ b/lib/classes/caption/record.class.php @@ -59,8 +59,7 @@ class caption_record implements caption_interface, cache_cacheableInterface protected function retrieve_fields() { - if(is_array($this->fields)) - + if (is_array($this->fields)) return $this->fields; $fields = array(); @@ -97,7 +96,7 @@ class caption_record implements caption_interface, cache_cacheableInterface } catch (Exception $e) { - + } } $this->fields = $rec_fields; @@ -134,7 +133,6 @@ class caption_record implements caption_interface, cache_cacheableInterface { $fields = $this->retrieve_fields(); if (isset($this->dces_elements[$label])) - return $fields[$this->dces_elements[$label]]; return null; } @@ -172,7 +170,10 @@ class caption_record implements caption_interface, cache_cacheableInterface , $field->highlight_thesaurus() ); - $fields[$field->get_name()] = $value; + $fields[$field->get_name()] = array( + 'value' => $value + , 'separator' => $field->get_databox_field()->get_separator() + ); } if ($searchEngine instanceof searchEngine_adapter) @@ -185,7 +186,7 @@ class caption_record implements caption_interface, cache_cacheableInterface foreach ($fields as $key => $value) { - $fields[$key] = $ret[$n]; + $fields[$key]['value'] = $ret[$n]; $n++; } } diff --git a/lib/classes/record/adapter.class.php b/lib/classes/record/adapter.class.php index e35b4e85ce..0614dd0f32 100644 --- a/lib/classes/record/adapter.class.php +++ b/lib/classes/record/adapter.class.php @@ -870,9 +870,9 @@ class record_adapter implements record_Interface, cache_cacheableInterface $titles = array(); foreach ($retrieved_fields as $key => $value) { - if (trim($value === '')) + if (trim($value['value'] === '')) continue; - $titles[] = $value; + $titles[] = $value['value']; } $title = trim(implode(' - ', $titles)); } diff --git a/lib/classes/searchEngine/adapter/phrasea/engine.class.php b/lib/classes/searchEngine/adapter/phrasea/engine.class.php index 965eb33c4a..416f5f0446 100644 --- a/lib/classes/searchEngine/adapter/phrasea/engine.class.php +++ b/lib/classes/searchEngine/adapter/phrasea/engine.class.php @@ -639,9 +639,20 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract foreach ($fields as $name => $field) { if ($sxe->description->$name) - $ret[] = str_replace(array('[[em]]', '[[/em]]'), array('', ''), (string) $sxe->description->$name); + { + $val = array(); + foreach($sxe->description->$name as $value) + { + $val[] = str_replace(array('[[em]]', '[[/em]]'), array('', ''), (string) $value); + } + $val = implode(' '.$field['separator'].' ', $val); + } else - $ret[] = $field; + { + $val = $field['value']; + } + + $ret[] = $val; } return $ret; diff --git a/lib/classes/searchEngine/adapter/sphinx/engine.class.php b/lib/classes/searchEngine/adapter/sphinx/engine.class.php index 29b2c72346..0967d8e8d2 100644 --- a/lib/classes/searchEngine/adapter/sphinx/engine.class.php +++ b/lib/classes/searchEngine/adapter/sphinx/engine.class.php @@ -752,8 +752,15 @@ class searchEngine_adapter_sphinx_engine extends searchEngine_adapter_abstract i 'before_match' => "", 'after_match' => "" ); + + $fields_to_send = array(); + + foreach($fields as $k=>$f) + { + $fields_to_send[$k] = $f['value']; + } - return $this->sphinx->BuildExcerpts($fields, $index, $query, $opts); + return $this->sphinx->BuildExcerpts($fields_to_send, $index, $query, $opts); } } diff --git a/templates/web/common/caption_templates/answer.html b/templates/web/common/caption_templates/answer.html index f1fb7e9bf2..3e219f8320 100644 --- a/templates/web/common/caption_templates/answer.html +++ b/templates/web/common/caption_templates/answer.html @@ -1,5 +1,5 @@ {% macro format_caption(record, highlight, searchEngine) %} {% for name, value in record.get_caption().get_highlight_fields(highlight, null, searchEngine) %} -
{{name}} : {{value|raw}}
+
{{name}} : {{value.value|raw}}
{% endfor %} {% endmacro %} \ No newline at end of file diff --git a/templates/web/common/caption_templates/basket_element.html b/templates/web/common/caption_templates/basket_element.html index 8e4e1afefb..1ed37f824d 100644 --- a/templates/web/common/caption_templates/basket_element.html +++ b/templates/web/common/caption_templates/basket_element.html @@ -1,5 +1,5 @@ {% macro format_caption(record) %} {% for name, value in record.get_caption().get_highlight_fields() %} -
{{name}} : {{value|raw}}
+
{{name}} : {{value.value|raw}}
{% endfor %} {% endmacro %} \ No newline at end of file diff --git a/templates/web/common/caption_templates/internal_publi.html b/templates/web/common/caption_templates/internal_publi.html index 8e4e1afefb..1ed37f824d 100644 --- a/templates/web/common/caption_templates/internal_publi.html +++ b/templates/web/common/caption_templates/internal_publi.html @@ -1,5 +1,5 @@ {% macro format_caption(record) %} {% for name, value in record.get_caption().get_highlight_fields() %} -
{{name}} : {{value|raw}}
+
{{name}} : {{value.value|raw}}
{% endfor %} {% endmacro %} \ No newline at end of file diff --git a/templates/web/common/caption_templates/lazaret.html b/templates/web/common/caption_templates/lazaret.html index 8e4e1afefb..1ed37f824d 100644 --- a/templates/web/common/caption_templates/lazaret.html +++ b/templates/web/common/caption_templates/lazaret.html @@ -1,5 +1,5 @@ {% macro format_caption(record) %} {% for name, value in record.get_caption().get_highlight_fields() %} -
{{name}} : {{value|raw}}
+
{{name}} : {{value.value|raw}}
{% endfor %} {% endmacro %} \ No newline at end of file diff --git a/templates/web/common/caption_templates/overview.html b/templates/web/common/caption_templates/overview.html index 04e2d1278b..55d1775e11 100644 --- a/templates/web/common/caption_templates/overview.html +++ b/templates/web/common/caption_templates/overview.html @@ -1,5 +1,5 @@ {% macro format_caption(record) %} {% for name, value in record.get_caption().get_highlight_fields() %} -
{{name}} : {{value|raw}}
+
{{name}} : {{value.value|raw}}
{% endfor %} {% endmacro %} \ No newline at end of file diff --git a/templates/web/common/caption_templates/preview.html b/templates/web/common/caption_templates/preview.html index f1fb7e9bf2..3e219f8320 100644 --- a/templates/web/common/caption_templates/preview.html +++ b/templates/web/common/caption_templates/preview.html @@ -1,5 +1,5 @@ {% macro format_caption(record, highlight, searchEngine) %} {% for name, value in record.get_caption().get_highlight_fields(highlight, null, searchEngine) %} -
{{name}} : {{value|raw}}
+
{{name}} : {{value.value|raw}}
{% endfor %} {% endmacro %} \ No newline at end of file