Fix search query

This commit is contained in:
Nicolas Le Goff
2015-02-06 16:06:41 +01:00
parent 5a62787b85
commit f385af1bbf

View File

@@ -709,18 +709,18 @@ class PhraseaEngine implements SearchEngineInterface
} }
// date // date
if (($options->getMinDate() || $this->options->getMaxDate()) && $this->options->getDateFields()) { if (($options->getMinDate() || $options->getMaxDate()) && $options->getDateFields()) {
if ($options->getMinDate()) { if ($options->getMinDate()) {
$clauses[] = 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'); $clauses[] = implode(' >= ' . $options->getMinDate()->format('Y-m-d') . ' OR ', array_map(function (\databox_field $field) { return $field->get_name(); }, $options->getDateFields())) . ' >= ' . $options->getMinDate()->format('Y-m-d');
} }
if ($options->getMaxDate()) { if ($options->getMaxDate()) {
$clauses[] = 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'); $clauses[] = implode(' <= ' . $options->getMaxDate()->format('Y-m-d') . ' OR ', array_map(function (\databox_field $field) { return $field->get_name(); }, $options->getDateFields())) . ' <= ' . $options->getMaxDate()->format('Y-m-d');
} }
} }
// record type // record type
if ($options->getRecordType()) { if ($options->getRecordType()) {
$clauses[] = 'recordtype=' . $this->options->getRecordType(); $clauses[] = 'recordtype=' . $options->getRecordType();
} }
// join clauses to build a query // join clauses to build a query