We noticed the following problem with the search result titles.
If the page title is "Apples & Oranges", it's displayed as "Apples & Oranges" in the search results.
Similarly, if the page title is "Tom's breakfast", it's displayed as "Tom'breakfast".
GSA-produced xml output has "Apples & Oranges", after the theme is applied it becomes "Apples & Oranges" (source) and displayed as "Apples & Oranges" in a browser.
The fix was to decode title. Replace
'title' => strip_tags($result->T),
with
'title' => decode_entities((string)strip_tags($result->T)),
function theme_google_appliance_search_result_array($result) {
$result = $result->result;
.....
// These fields are processed by *_preprocess_search_result()
// functions, including:
// - template_preprocess_search_result()
// - google_appliance_preprocess_search_result()
return array(
// Google Appliance-specific items:
'google_appliance' => TRUE, // A flag for the pre-process functions.
'attributes' => $attributes,
'meta_data' => $meta_data,
// Standard search result items:
'link' => (string) $result->U,
// 'title' => strip_tags($result->T),
'title' => decode_entities((string)strip_tags($result->T)),
'snippet' => decode_entities((string) $result->S),
'type' => $meta_data['type'][0],
'user' => $meta_data['author'][0],
'date' => strtotime($meta_data['modified'][0]),
'extra' => array(),
);
}
Comments
Comment #1
larskleiner commentedI can't reproduce your issue but then again it might be because my document titles have Word-style custom single quotes. Feel free to override the google_appliance_search_result_array default theme if that helps, I wouldn't change it at this point though.
Comment #2
benschaaf commentedThanks for posting this.
I was having the same issue and this quick fix resolved my issue.