diff --git a/IslandoraSolrQueryProcessor.inc b/IslandoraSolrQueryProcessor.inc index 8666810d..8e60eb4c 100644 --- a/IslandoraSolrQueryProcessor.inc +++ b/IslandoraSolrQueryProcessor.inc @@ -166,7 +166,7 @@ class IslandoraSolrQueryProcessor { } } if (!empty($this->solrQuery) && strcmp($this->solrQuery, ' ')) { - $cutlink = "islandora/solr/search/ /" . $islandora_fq . "/dismax"; + $cutlink = "islandora/solr/search/ /". $islandora_fq ."/dismax"; $queryval = $this->solrQuery; $tokens = explode(" ", $queryval); diff --git a/IslandoraSolrResults.inc b/IslandoraSolrResults.inc index 6a73c473..f16c73b1 100644 --- a/IslandoraSolrResults.inc +++ b/IslandoraSolrResults.inc @@ -225,6 +225,30 @@ class IslandoraSolrResults { ); return theme('fieldset', $fieldset_r); } + + const FIELD_ALL = 0, FIELD_SEARCH = 1, FIELD_FACET = 2, FIELD_RESULT = 3; + + function _make_pattern($string) { + return "/^". preg_quote($string, '/') ."/"; + } + function getSubstitutedFields($string_in, $type = FIELD_SEARCH) { + $replacements = NULL; + switch($type) { + case FIELD_SEARCH: + $replacements = $this->searchFieldArray; + break; + case FIELD_FACET: + $replacements = $this->facetFieldArray; + break; + case FIELD_RESULT: + $replacements = $this->resultFieldArray; + break; + case FIELD_ALL: + default: + $replacements = $this->allSubsArray; + } + return preg_replace(array_map(array($this, '_make_pattern'), array_keys($replacements)), array_values($replacements), $string_in); + } /** * Function: currentQuery @@ -258,7 +282,7 @@ class IslandoraSolrResults { // and allow one part to be removed at a time. // // Image loc: $base_url.'/'.drupal_get_path('module', 'islandora_solr_search').'/images/delete.png - $query = " "; + $query = "*:*"; $fq = replaceSlashes($islandora_fq); $defType = $solrQueryProcessor->solrDefType; $query_list_items[] .= l('-', "islandora/solr/search/$query/$fq/$defType", @@ -266,7 +290,7 @@ class IslandoraSolrResults { 'html' => true, 'attributes' => array( 'class' => 'islandora_solr_add_remove_link')) - ) . ' ' . stripslashes($solrQueryProcessor->solrQuery); + ) . ' ' . $this->getSubstitutedFields(stripslashes($solrQueryProcessor->solrQuery), FIELD_SEARCH); $output .= '