0

Is there a programmatic way in which I can set the value of the catalog index SearchableText for an specific object?

I'm using wsapi4plone to upload files to plone, but it has a bug (already reported) and it doesn't set catalog's SearchableText. I would like to be able to set it myself. I tried reindexObject() but it didn't worked.

jdinunzio
  • 1,506
  • 1
  • 11
  • 26
  • What kind of objects are we talking about here? Archetypes, Dexterity, standard Plone content types? – Martijn Pieters May 29 '13 at 22:59
  • Archetypes. I'm using Plone 4.2. The object uploaded are Files – jdinunzio May 29 '13 at 23:23
  • And what type of files are you uploading? – Martijn Pieters May 29 '13 at 23:41
  • PDF files. If I upload these files using plone interface, everithing goes well. But if I use wsapi4plone.post_object, SearchableText is empty. That's why I need a way to regenerate SearchableText *just for a particular object*. – jdinunzio May 30 '13 at 00:55
  • If SearchableText doesn't work when wsapi4plone posts the file something more is wrong than just searchable text not working; a reindex should normally fix this. – Martijn Pieters May 30 '13 at 07:29

1 Answers1

1

File object contents need to be transformable; the portal_transforms tool needs to be able to produce text from their binary contents.

For PDF files, for example, the pdf_to_text transform either uses the poppler or the xpdf command-line tools to extract text from the document to index. Word documents require the wv package, etc.

You need to make sure the right tools are installed for your platform for these transforms to work.

These older knowledgebase articles still apply to Plone 4:

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • Thanks. portal_transforms works fine. If I add a PDF file using plone interface everything is OK. The problem is when it's uploaded using wsapi4plone. So, I intercepted wsapi4plone.post_object. Now I need a way to reindex SearchableText in the recent created object. reindexObject() didn't work. Is there another way to set SearchableText? – jdinunzio May 30 '13 at 00:53
  • But are you creating normal File content types? Sorry if is a stupi question, I don't know wsapi4plone. – keul May 30 '13 at 15:08