[prev in list] [next in list] [prev in thread] [next in thread]
List: kolab-commits
Subject: Branch 'roundcubemail-plugins-kolab-format2-horde5' - plugins/libkolab
From: Thomas_BrĂ¼derli <bruederli () kolabsys ! com>
Date: 2013-03-25 20:28:23
Message-ID: 20130325202823.2CBDD3EF172 () app01 ! kolabsys ! com
[Download RAW message or body]
plugins/libkolab/lib/kolab_format_event.php | 28 ++++++++++++++++++++++++++++
plugins/libkolab/lib/kolab_format_task.php | 20 +++++++++++++++++++-
2 files changed, 47 insertions(+), 1 deletion(-)
New commits:
commit cfecfbd58f2810c01a1079e8fd98b705c84a6829
Author: Thomas Bruederli <thomas@roundcube.net>
Date: Mon Mar 25 21:27:56 2013 +0100
Provide words for fulltext search in event and task objects (#1714)
diff --git a/plugins/libkolab/lib/kolab_format_event.php \
b/plugins/libkolab/lib/kolab_format_event.php index 35f8cf4..96fcac6 100644
--- a/plugins/libkolab/lib/kolab_format_event.php
+++ b/plugins/libkolab/lib/kolab_format_event.php
@@ -241,6 +241,34 @@ class kolab_format_event extends kolab_format
}
/**
+ * Callback for kolab_storage_cache to get words to index for fulltext search
+ *
+ * @return array List of words to save in cache
+ */
+ public function get_words()
+ {
+ $data = '';
+ foreach (self::$fulltext_cols as $colname) {
+ list($col, $field) = explode(':', $colname);
+
+ if ($field) {
+ $a = array();
+ foreach ((array)$this->data[$col] as $attr)
+ $a[] = $attr[$field];
+ $val = join(' ', $a);
+ }
+ else {
+ $val = is_array($this->data[$col]) ? join(' ', $this->data[$col]) : \
$this->data[$col]; + }
+
+ if (strlen($val))
+ $data .= $val . ' ';
+ }
+
+ return array_unique(rcube_utils::normalize_string($data, true));
+ }
+
+ /**
* Load data from old Kolab2 format
*/
public function fromkolab2($rec)
diff --git a/plugins/libkolab/lib/kolab_format_task.php \
b/plugins/libkolab/lib/kolab_format_task.php index 9b7f142..02b32b3 100644
--- a/plugins/libkolab/lib/kolab_format_task.php
+++ b/plugins/libkolab/lib/kolab_format_task.php
@@ -28,7 +28,7 @@ class kolab_format_task extends kolab_format
protected $xmltype = 'task';
- public static $fulltext_cols = array('title', 'description', 'location', \
'attendees:name', 'attendees:email', 'categories'); + public static $fulltext_cols \
= array('title', 'description', 'location', 'categories');
// Kolab 2 format field map
private $kolab2_fieldmap = array(
@@ -160,4 +160,22 @@ console($this->data, $this->kolab_object);
return $tags;
}
+
+ /**
+ * Callback for kolab_storage_cache to get words to index for fulltext search
+ *
+ * @return array List of words to save in cache
+ */
+ public function get_words()
+ {
+ $data = '';
+ foreach (self::$fulltext_cols as $col) {
+ $val = is_array($this->data[$col]) ? join(' ', $this->data[$col]) : \
$this->data[$col]; + if (strlen($val))
+ $data .= $val . ' ';
+ }
+
+ return array_unique(rcube_utils::normalize_string($data, true));
+ }
+
}
_______________________________________________
kolab-commits mailing list
kolab-commits@kolab.org
https://www.intevation.de/mailman/listinfo/kolab-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic