[SearchEngine] Fix tests

This commit is contained in:
Romain Neutron
2012-10-29 21:40:43 +01:00
parent a27c82b0b3
commit 3e172857bc
2 changed files with 3 additions and 3 deletions

View File

@@ -577,10 +577,10 @@ class PhraseaEngine implements SearchEngineInterface
} }
if (($this->options->getMinDate() || $this->options->getMaxDate()) && $this->options->getDateFields()) { if (($this->options->getMinDate() || $this->options->getMaxDate()) && $this->options->getDateFields()) {
if ($this->options->getMinDate()) { if ($this->options->getMinDate()) {
$this->queries[$sbas] .= ' AND ( ' . implode(' >= ' . $this->options->getMinDate()->format('Y-m-d') . ' OR ', $this->options->getDateFields()) . ' >= ' . $this->options->getMinDate()->format('Y-m-d') . ' ) '; $this->queries[$sbas] .= ' AND ( ' . implode(' >= ' . $this->options->getMinDate()->format('Y-m-d') . ' OR ', array_map(function(\databox_field $field){ return $field->get_name(); }, $this->options->getDateFields())) . ' >= ' . $this->options->getMinDate()->format('Y-m-d') . ' ) ';
} }
if ($this->options->getMaxDate()) { if ($this->options->getMaxDate()) {
$this->queries[$sbas] .= ' AND ( ' . implode(' <= ' . $this->options->getMaxDate()->format('Y-m-d') . ' OR ', $this->options->getDateFields()) . ' <= ' . $this->options->getMaxDate()->format('Y-m-d') . ' ) '; $this->queries[$sbas] .= ' AND ( ' . implode(' <= ' . $this->options->getMaxDate()->format('Y-m-d') . ' OR ', array_map(function(\databox_field $field){ return $field->get_name(); }, $this->options->getDateFields())) . ' <= ' . $this->options->getMaxDate()->format('Y-m-d') . ' ) ';
} }
} }
} }

View File

@@ -417,7 +417,7 @@
<option onchange="checkFilters(true);" <option onchange="checkFilters(true);"
class="" value="{{ field }}">{{ field }}</option> class="" value="{{ field }}">{{ field }}</option>
{% endfor %} {% endfor %}
<option value="{{configuration['date_fields']|keys|join('|')}}" selected="selected"> <option value="{{ app['phraseanet.SE'].getAvailableDateFields()|join('|') }}" selected="selected">
{% trans 'rechercher dans tous les champs' %} {% trans 'rechercher dans tous les champs' %}
</option> </option>
</select> </select>