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, including proprietary file formats such as .pdf, .doc, .ppt, etc.
- 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).
Note: Trac 0.11.4 or later is required.
If you have any issues, create a new ticket.
Download the zipped source from here.
- Install swish-e, the open source system for indexing documents.
- Download the source code to YOUR_SOURCE_DIR.
- Install the plugin:
python setup.py bdist_egg cp dist/TracSearchAttachmentsPlugin-0.1-py2.4.egg /path/to/your/env/plugins/
- Use the trac-seat utility to index existing attachments:
cp YOUR_SOURCE_DIR/searchattachmentsplugin/0.10/trac-seat /path/to/your/env/index cd /path/to/your/env/index chmod +x trac-seat ./trac-seat /path/to/your/env meta ./trac-seat /path/to/your/env index -c cd .. chown -R apache:apache /path/to.your/env/index
- Configure your
trac.inifile as follows:
[components] ... searchattachments.* = enabled [attachment] ... # This is the path to the swish-e command on your system swish = /usr/local/bin/swish-e seat = /path/to/your/env/trac-seat # The first %s is the absolute path of the input file. # The second %s is the absolute path of the text file generated by the command. filter.doc = /usr/local/bin/catdoc -b "%s" > "%s" filter.ppt = /usr/local/bin/catppt "%s" > "%s" filter.pdf = /usr/bin/pdftotext "%s" "%s"
Comment: I have had better success omitting the -b flag to catdoc.
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.EXTENSION = path_to_EXTENSION_to_text_command -infile "%s" -outfile "%s"
- Restart the Trac server.