changeset 1479:b1562b232683

fix for deleting from xapian index
author Franz Pletz <fpletz AT franz-pletz DOT org>
date Thu, 24 Aug 2006 15:33:44 +0200
parents 53e9c1db5ace
children c222d149e93f
files MoinMoin/action/AttachFile.py MoinMoin/search/Xapian.py
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/AttachFile.py	Thu Aug 24 15:25:15 2006 +0200
+++ b/MoinMoin/action/AttachFile.py	Thu Aug 24 15:33:44 2006 +0200
@@ -645,6 +645,12 @@
     os.remove(fpath)
     _addLogEntry(request, 'ATTDEL', pagename, filename)
 
+    if request.cfg.xapian_search:
+        from MoinMoin.search.Xapian import Index
+        index = Index(request)
+        if index.exists:
+            index.remove_item(pagename, filename)
+
     upload_form(pagename, request, msg=_("Attachment '%(filename)s' deleted.") % {'filename': filename})
 
 
--- a/MoinMoin/search/Xapian.py	Thu Aug 24 15:25:15 2006 +0200
+++ b/MoinMoin/search/Xapian.py	Thu Aug 24 15:33:44 2006 +0200
@@ -573,7 +573,7 @@
         else:
             # Only remove a single attachment
             query = xapidx.RawQuery(xapidx.makePairForWrite('itemid',
-                "%s:%s//%s" % (wikiname, pagename, att)))
+                "%s:%s//%s" % (wikiname, pagename, attachment)))
             enq, mset, docs = writer.search(query, valuesWanted=['pagename',
                 'attachment', ])
             if docs: