Version 4 (modified by deltroo, 11 years ago) (diff)


SEAT plugin: SEarch wiki and ticket ATtachments

Notice: This plugin is unmaintained and available for adoption.


This plugin allows text integral search in wiki and ticket attachments (.pdf, .doc,.ppt,...). The SEAT plugin has the following features:

  • new Attachments source to the search page
  • an excerpt of the matching documents is presented in the result page
  • any format is supported as long as there is a command line tool for plain text conversion (filter command)

Bugs/Feature Requests

Existing bugs and feature requests for SearchAttachmentsPlugin are here.

If you have any issues, create a new ticket.


Download the zipped source from [download:searchattachmentsplugin here].


You can check out SearchAttachmentsPlugin from here using Subversion, or browse the source with Trac.

How to install?

  • Download the plugin from xxxx
  • Install the plugin
        python set-up bdist_egg
        cp searchattachmpents.egg YOUR_TRAC_ENV/plugins
  • Configure the [attachment] section of trac.ini

searchattachments.* = enabled

swish = /usr/bin/local/swish-e
filter.doc = /usr/local/bin/catdoc -b "%s" > "%s"
filter.ppt = /usr/local/bin/catppt "%s" > "%s"
filter.pdf = /usr/bin/pdftotext "%s" "%s"


path to the swish-e command on your system.


command to use for converting a non-text format to text. The command takes a file as input (first %s) and writes the generated a text file in a file (second %s):

There is no need to declare a filter command for .txt or .text. Text files are handled natively. To index a new non-text format, just add a filter.* entry using the appropriate command line tool for this format.

   filter.myEXT = my_command -infile "%s" -outfile "%s"
  • Trac 10.x and 11.x source code must be manually modified for SEAT plugin to work. The file to modify is On a Linux Fedora system, it is located in /usr/lib/python2.4/site-packages/trac
162     def insert(self, filename, fileobj, size, t=None, db=None):
184         try:
185             # Note: `path` is an unicode string because `self.path` was one.
186             # As it contains only quoted chars and numbers, we can use `ascii`
187             basename = os.path.basename(path).encode('ascii')
188             filename = unicode_unquote(basename)
190             cursor = db.cursor()
191             cursor.execute("INSERT INTO attachment "
192                            "VALUES (%s,%s,%s,%s,%s,%s,%s,%s)",
193                            (self.parent_type, self.parent_id, filename,
194                             self.size, self.time, self.description,,
195                             self.ipnr))
196             shutil.copyfileobj(fileobj, targetfile)
197             self.filename = filename
199   'New attachment: %s by %s', self.title,
202             if handle_ta:
203                 db.commit()
   205             targetfile.close() # << Line to add for SEAT plugin
207             for listener in AttachmentModule(self.env).change_listeners:
208                 listener.attachment_added(self)
209         finally:
210             targetfile.close()

  • Add the trac-seat utility to your path. For instance, copy trac-seat to /usr/local/bin.
  • Use trac-seat to convert existing attachments to text files and index these.
    trac-seat /path/to/your/env meta
    trac-seat /path/to/your/env index -c
  • restart the trac server ( /etc/init.d/httpd restart)

Recent Changes

15177 by rjollos on 2016-01-26 18:12:25
0.2dev: Fix indentation using
14892 by rjollos on 2015-08-28 00:22:07
Convert to datetime. Untested patch by srl100@…. Fixes #4930.
14470 by rjollos on 2015-02-27 21:50:21
Branching for Trac 1.0.


Author: deltroo