From c11c3322f4cd7de5b8445e03eee1fee749980f9b Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 28 Oct 2011 14:40:56 -0300 Subject: [PATCH] Use simpler grouping instead of nested/sub queries. Something of an oversight on my part, for missing this ability. --- IslandoraSolrResults.inc | 4 ++-- islandora_solr_search.module | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/IslandoraSolrResults.inc b/IslandoraSolrResults.inc index ecd15afe..5dd6117e 100644 --- a/IslandoraSolrResults.inc +++ b/IslandoraSolrResults.inc @@ -481,7 +481,7 @@ EOT; function _add_field(&$form, &$i, &$unprocessed_contents, &$types) { $type = NULL; - $temp = preg_split('/:/', trim($unprocessed_contents, '()'), 2); + $temp = preg_split('/:/', $unprocessed_contents, 2); if (!isset($type)) { if (trim($temp[0]) === '_query_') { @@ -495,7 +495,7 @@ EOT; } else { $type = $temp[0]; - $terms = trim($temp[1]); + $terms = trim($temp[1], '()'); } } diff --git a/islandora_solr_search.module b/islandora_solr_search.module index c58527e6..30ae3e88 100644 --- a/islandora_solr_search.module +++ b/islandora_solr_search.module @@ -385,7 +385,13 @@ function islandora_solr_search_block_form_submit($form, &$form_state) { } for ($iteration = 0; $iteration < count($fedora_terms); $iteration++) { - $searchString .= "_query_:\"{!dismax qf=" . $types[$iteration] . "}" . addcslashes($fedora_terms[$iteration], "\"'") . "\" " . $booleans[$iteration] . " "; + //FIXME (minor): t() should be changed to format_string() in this instance, in Drupal 7 + // The string isn't really translatable, just templated. + $searchString .= t("!field:(!query) !bool ", array( + '!field' => $types[$iteration], + '!query' => $fedora_terms[$iteration], + '!bool' => $booleans[$iteration] + )); } $searchString = trim($searchString); $searchString = drupal_urlencode($searchString);