Opened 6 years ago

Last modified 3 years ago

#10219 new defect

[patch] bring searchattachments plugin to a working state

Reported by: jholg Owned by:
Priority: normal Component: SearchAttachmentsPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11


SearchAttachmentsPlugin didn't quite work for me in several aspects so I applied some fixes to it. This has been a while and I always forgot to upload the corresponding patch, so here it is now.

Changes that I made (excerpt from my mercurial local repo changelog):

$ hg log -v|egrep -v "user"
changeset:   8:e7c0cbbd158f                                            
tag:         tip                                                       
date:        Thu Feb 18 17:02:32 2010 +0100                            
files:       0.11/searchattachments/               
more helpful log message if no index files found (means no attachments)

changeset:   7:cc617212dd70
date:        Thu Feb 18 16:30:19 2010 +0100
files:       0.11/searchattachments/
fixed unicode issue                                     

changeset:   6:d0afeb0b8a4b
date:        Thu Feb 11 11:25:20 2010 +0100
files:       0.11/searchattachments/
fixed options                                           

changeset:   5:bb5fdc6dc688
date:        Wed Feb 10 15:16:59 2010 +0100
files:       0.11/searchattachments/
Many changes, including reformatting and saner excerpt extraction, with
options to switch off excerpts and for limiting excerpt search and excerpt
result length.                                                            

changeset:   4:49a9ec1eb7a9
date:        Tue Feb 09 15:05:44 2010 +0100
files:       0.11/searchattachments/
reformat for better style-guide conformity

changeset:   3:7ad1c267ebf4
date:        Wed Dec 30 15:32:39 2009 +0100
files:       0.11/searchattachments/ 0.11/trac-seat
Fixed indentation using, use spaces now instead of tabs.
trac-seat now indexes txt files, too. Force foreground job for attachment
deletions to not get inconsistent indexing in case of 'replace attachm.
with the same name' operations. Excerpt handling now works for files that
do not contain any newlines before a search keyword.

changeset:   2:bd327f343d0c
date:        Mon Dec 28 14:39:05 2009 +0100
files:       0.11/trac-seat
removed obsolete commented-out stuff

changeset:   1:4540952d9e13
date:        Wed Dec 23 17:07:23 2009 +0100
files:       0.11/searchattachments/ 0.11/ 0.11/trac-seat
1st working version. Changes:
 * trac-seat added as script to
 * trac-seat fixed: Option parsing now working, use trac Configuration class
   for ini file access (otherwise, inherit mechanisms will not work), some
   fixes regarding reading the relevant config sections
 * change config section name to use 'searchattachments' consistently
 * fixed seat and swish options
 * use absolute urls in results to support multi-project (tracforge) setups;
   absolute urls are constructed from the request href

changeset:   0:2b345fa0a9a3
date:        Wed Dec 23 14:19:46 2009 +0100
files:       0.10/README 0.10/searchattachments/ 
0.11/README 0.11/searchattachments/ 
0.11/ 0.11/trac-seat
initial checkin

I've been running this ever since in a production trac environment and it works quite nicely.

Attachments (2)

searchattachmentsplugin.diff (43.7 KB) - added by jholg 6 years ago.
hg diff patch for searchattachments plugin
searchattachmentsplugin.tgz (20.6 KB) - added by jholg 6 years ago.

Download all attachments as: .zip

Change History (6)

Changed 6 years ago by jholg

hg diff patch for searchattachments plugin

comment:1 Changed 6 years ago by jholg

My trac.ini section:

filter.doc = catdoc "%s" > "%s"
filter.odt = odt2txt "%s" --output="%s"
filter.pdf = pdftotext "%s" "%s"       
filter.ppt = catppt "%s" > "%s"        
filter.xls = /export/opt/swish-e/2.4.7/bin/swish-filter-test -content -quiet "%s" > "%s"                                                                  
seat = /export/python/virtualenvs/trac/bin/trac-seat                                   
swish = /export/opt/swish-e/2.4.7/bin/swish-e    

Your paths may vary.

Last edited 3 years ago by Ryan J Ollos (previous) (diff)

Changed 6 years ago by jholg

Attachment: searchattachmentsplugin.tgz added

comment:2 Changed 6 years ago by jholg

Attached zipped archive in addition to the patch file. Unfortunately I can't recollect which revision of SearchAttachmentsPlugin this was all based on, but judging from changelog nothing seems to have changed in the official version since I dowloaded it and made my changes.

comment:3 Changed 6 years ago by Ryan J Ollos

Thanks, I'll look into getting this pulled in this weekend.

comment:4 Changed 3 years ago by Ryan J Ollos

Owner: Ryan J Ollos deleted

The patch doesn't apply cleanly to the 1.0 branch, so some work is needed. If anyone wants to rebase the patch I'll apply it.

Modify Ticket

Change Properties
Set your email in Preferences
as new The ticket will remain with no owner.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.