moksha/connector/utils.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
New commits:
commit 2f6b2aa0acbe9e377af0b06c8c5c0a6a3867345c
Author: John (J5) Palmieri <johnp(a)redhat.com>
Date: Mon Jul 20 16:09:52 2009 -0400
fix search so it ranks correctly
diff --git a/moksha/connector/utils.py b/moksha/connector/utils.py
index 36d7e6a..3b6e791 100644
--- a/moksha/connector/utils.py
+++ b/moksha/connector/utils.py
@@ -281,16 +281,18 @@ class WeightedSearch(object):
item = weighted_item[0]
for i, col_label in enumerate(self.cols):
x = col_count - i
- weight_factor = float(x) * factor
+ weight_factor = float(x) * factor
col_value = item.get(col_label,'')
+
if not isinstance(col_value, basestring):
col_value = ''
else:
if not isinstance(col_value, unicode):
- col_value = unicode(item.get(col_value, ''), 'utf-8')
+ col_value = unicode(col_value, 'utf-8')
+
col_value = col_value.lower()
-
+
index = col_value.find(search_term)
while(index != -1):