Browse Source

[search] Do not convert to string multivalue fields

Now escapes the list of values.
There is only one level of nesting in multivalue fields.
Romain Rigaux 10 năm trước cách đây
mục cha
commit
5838f00912
2 tập tin đã thay đổi với 43 bổ sung0 xóa
  1. 2 0
      apps/search/src/search/models.py
  2. 41 0
      apps/search/src/search/tests.py

+ 2 - 0
apps/search/src/search/models.py

@@ -806,6 +806,8 @@ def augment_solr_response(response, collection, query):
     for field, value in doc.iteritems():
       if isinstance(value, numbers.Number):
         escaped_value = value
+      elif isinstance(value, list): # Multivalue field
+        escaped_value = [smart_unicode(val, errors='replace') for val in value]
       else:
         value = smart_unicode(value, errors='replace')
         escaped_value = escape(value)

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 41 - 0
apps/search/src/search/tests.py


Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác