[Erp5-report] r9007 - /erp5/trunk/products/ERP5OOo/Document/DMSFile.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Aug 2 20:18:49 CEST 2006


Author: bartek
Date: Wed Aug  2 20:18:47 2006
New Revision: 9007

URL: http://svn.erp5.org?rev=9007&view=rev
Log:
Support for document-type attributes, incl. SearchableText.

Modified:
    erp5/trunk/products/ERP5OOo/Document/DMSFile.py

Modified: erp5/trunk/products/ERP5OOo/Document/DMSFile.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/Document/DMSFile.py?rev=9007&r1=9006&r2=9007&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/Document/DMSFile.py (original)
+++ erp5/trunk/products/ERP5OOo/Document/DMSFile.py Wed Aug  2 20:18:47 2006
@@ -66,6 +66,23 @@
   _edit=File._edit
   edit=File.edit
 
+  ### Content indexing methods
+  security.declareProtected(Permissions.View, 'getSearchableText')
+  def getSearchableText(self, md=None):
+    """\
+    Used by the catalog for basic full text indexing
+    And so we end up with a strange hybrid of File and Document
+    This is the same as in OOoDocument except that no text_content here
+    Some people call it 'copy-and-paste programming'
+    """
+    searchable_attrs=('title','description','id','reference','version',
+        'short_title','keywords','subject','original_filename','source_project_title')
+    searchable_text = ' '.join(map(lambda x: self.getProperty(x) or ' ',searchable_attrs))
+    return searchable_text
+
+  SearchableText=getSearchableText
+
+
   # BG copied from File in case
   index_html = CMFFile.index_html
   PUT = CMFFile.PUT




More information about the Erp5-report mailing list