aboutsummaryrefslogtreecommitdiff
path: root/mod/search
diff options
context:
space:
mode:
Diffstat (limited to 'mod/search')
-rw-r--r--mod/search/pages/search/index.php12
-rw-r--r--mod/search/search_hooks.php2
-rw-r--r--mod/search/start.php7
-rw-r--r--mod/search/views/default/search/list.php2
-rw-r--r--mod/search/views/default/search/search_box.php3
5 files changed, 14 insertions, 12 deletions
diff --git a/mod/search/pages/search/index.php b/mod/search/pages/search/index.php
index efa3ec037..fcd95c43e 100644
--- a/mod/search/pages/search/index.php
+++ b/mod/search/pages/search/index.php
@@ -145,11 +145,7 @@ foreach ($custom_types as $type) {
$data = htmlspecialchars(http_build_query(array(
'q' => $query,
- 'entity_subtype' => $entity_subtype,
- 'entity_type' => $entity_type,
- 'owner_guid' => $owner_guid,
'search_type' => $type,
- 'friends' => $friends
)));
$url = elgg_get_site_url()."search?$data";
@@ -240,8 +236,6 @@ if ($search_type != 'entities' || $search_type == 'all') {
$current_params = $params;
$current_params['search_type'] = $type;
- // custom search types have no subtype.
- unset($current_params['subtype']);
$results = elgg_trigger_plugin_hook('search', $type, $current_params, array());
@@ -263,7 +257,11 @@ if ($search_type != 'entities' || $search_type == 'all') {
}
// highlight search terms
-$searched_words = search_remove_ignored_words($display_query, 'array');
+if ($search_type == 'tags') {
+ $searched_words = array($display_query);
+} else {
+ $searched_words = search_remove_ignored_words($display_query, 'array');
+}
$highlighted_query = search_highlight_words($searched_words, $display_query);
$body = elgg_view_title(elgg_echo('search:results', array("\"$highlighted_query\"")));
diff --git a/mod/search/search_hooks.php b/mod/search/search_hooks.php
index ab000f6f6..2143a0d24 100644
--- a/mod/search/search_hooks.php
+++ b/mod/search/search_hooks.php
@@ -284,7 +284,7 @@ function search_tags_hook($hook, $type, $value, $params) {
}
$tags_str = implode('. ', $matched_tags_strs);
- $tags_str = search_get_highlighted_relevant_substrings($tags_str, $params['query']);
+ $tags_str = search_get_highlighted_relevant_substrings($tags_str, $params['query'], 30, 300, true);
$entity->setVolatileData('search_matched_title', $title_str);
$entity->setVolatileData('search_matched_description', $desc_str);
diff --git a/mod/search/start.php b/mod/search/start.php
index bb8531e9c..d2d7ed3c2 100644
--- a/mod/search/start.php
+++ b/mod/search/start.php
@@ -83,15 +83,18 @@ function search_page_handler($page) {
* @param string $query
* @param int $min_match_context = 30
* @param int $max_length = 300
+ * @param bool $tag_match Search is for tags. Don't ignore words.
* @return string
*/
-function search_get_highlighted_relevant_substrings($haystack, $query, $min_match_context = 30, $max_length = 300) {
+function search_get_highlighted_relevant_substrings($haystack, $query, $min_match_context = 30, $max_length = 300, $tag_match = false) {
$haystack = strip_tags($haystack);
$haystack_length = elgg_strlen($haystack);
$haystack_lc = elgg_strtolower($haystack);
- $words = search_remove_ignored_words($query, 'array');
+ if (!$tag_match) {
+ $words = search_remove_ignored_words($query, 'array');
+ }
// if haystack < $max_length return the entire haystack w/formatting immediately
if ($haystack_length <= $max_length) {
diff --git a/mod/search/views/default/search/list.php b/mod/search/views/default/search/list.php
index c5249fe77..1ed40be1b 100644
--- a/mod/search/views/default/search/list.php
+++ b/mod/search/views/default/search/list.php
@@ -39,7 +39,7 @@ $url = elgg_get_site_url() . "search?$query";
// get pagination
if (array_key_exists('pagination', $vars['params']) && $vars['params']['pagination']) {
$nav = elgg_view('navigation/pagination',array(
- 'baseurl' => $url,
+ 'base_url' => $url,
'offset' => $vars['params']['offset'],
'count' => $vars['results']['count'],
'limit' => $vars['params']['limit'],
diff --git a/mod/search/views/default/search/search_box.php b/mod/search/views/default/search/search_box.php
index 87d59519c..ff12ae4f0 100644
--- a/mod/search/views/default/search/search_box.php
+++ b/mod/search/views/default/search/search_box.php
@@ -38,6 +38,7 @@ $display_query = htmlspecialchars($display_query, ENT_QUOTES, 'UTF-8', false);
<form class="<?php echo $class; ?>" action="<?php echo elgg_get_site_url(); ?>search" method="get">
<fieldset>
<input type="text" class="search-input" size="21" name="q" value="<?php echo elgg_echo('search'); ?>" onblur="if (this.value=='') { this.value='<?php echo elgg_echo('search'); ?>' }" onfocus="if (this.value=='<?php echo elgg_echo('search'); ?>') { this.value='' };" />
+ <input type="hidden" name="search_type" value="all" />
<input type="submit" value="<?php echo elgg_echo('search:go'); ?>" class="search-submit-button" />
</fieldset>
-</form> \ No newline at end of file
+</form>