From 6dc573c6fcf577cd0c24a1b3e046cb286e7fdf97 Mon Sep 17 00:00:00 2001 From: Gilles Crettenand Date: Mon, 15 Jun 2015 10:32:44 +0200 Subject: [PATCH] - correctly quote search query - do not set unnecessary params --- Lib/Search/BookSearch.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Lib/Search/BookSearch.php b/Lib/Search/BookSearch.php index d9e1d65..10e40d2 100644 --- a/Lib/Search/BookSearch.php +++ b/Lib/Search/BookSearch.php @@ -35,9 +35,6 @@ class BookSearch // most options like search fields, sorting, etc are already set // as default in the Solr config and thus should be set only on a // per request basis when needed - - $this->query->addField('*'); - $this->query->addParam('q.op', 'AND'); } public function addOrQuery(array $texts, $field) @@ -55,11 +52,13 @@ class BookSearch $queryText = \SolrUtils::escapeQueryChars($queryText); } + $queryText = "\"$queryText\""; + if (strlen($queryField) > 0) { - $queryText = "$queryField:\"$queryText\""; + $queryText = "$queryField:$queryText"; } - $this->queryParts[] = $queryText; + $this->queryParts[] = "$queryText"; } public function addSortField($field, $order = \SolrQuery::ORDER_DESC)