[Zope3-Users] Indexing PDF files

Sreeram Raghav raghav.sreeram at gmail.com
Wed May 10 16:29:34 EDT 2006


Hi all,
Thanks to Frank and Brend, I have successfully crated a catalog and indexed
ZPTpages.
Then I wanted to index text files and PDF files, so wrote an adapter like
this:
-----------------------------------------------------------------------------------------------------------------
adapter.py
-----------------------------------------------------------------------------------------------------------------
"""
The adapter "SearchableTextAdapter" adapts the interface "IFile" to the
interface
"ISearchableText". Based on Frank's 'adapter.py'.
"""

from zope.index.text.interfaces import ISearchableText
from zope.component import adapts
from zope.interface import implements
from zope.app.file.interfaces import IFile

class SearchableTextAdapter:
         implements(ISearchableText)
         adapts(IFile)

         def __init__(self, context):
              self.context = context

         def getSearchableText(self):
              return self.context.data

------------------------------------------------------------------------------------------------------
configure.zcml
------------------------------------------------------------------------------------------------------
<adapter
             factory = ".adapter.SearchableTextAdapter"
/>

------------------------------------------------------------------------------------------------------

After doing this I restared Zope3 and then went to the Zope3 manager and
added a new text file.
Initially the only files being indexed were "ZPT pages", but after writing
the adapter even text files were being indexed.
However the problem is that when I try to add a PDF of Word documents, the
files are not being indexed and showing an error that cannot decode files.

Will somebody please suggest me a solution fro this problem.
Thanks
--
Sreeram Nudurupati
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope3-users/attachments/20060510/7fa26f64/attachment.htm


More information about the Zope3-users mailing list