Skip to content

Commit 140e594

Browse files
author
Richard Jones
committed
rdbms backend full text search failure after import [SF#980314]
1 parent 7302ef8 commit 140e594

File tree

6 files changed

+59
-15
lines changed

6 files changed

+59
-15
lines changed

CHANGES.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ Feature:
1717

1818
2004-??-?? 0.7.5
1919
Fixed:
20+
- rdbms backend full text search failure after import (sf bug 980314)
21+
22+
23+
2004-06-24 0.7.5
24+
Fixed:
2025
- force lookup of journal props in anydbm filtering
2126
- fixed lookup of "missing" Link values for new props in anydbm backend
2227
- allow list of values for id, Number and Boolean filtering in anydbm

doc/index.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ Gus Gollings,
9090
Dan Grassi,
9191
Engelbert Gruber,
9292
Juergen Hermann,
93+
Uwe Hoffmann,
9394
Tobias Hunger,
9495
Simon Hyde,
9596
Christophe Kalt,

roundup/backends/back_anydbm.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
#$Id: back_anydbm.py,v 1.157 2004-06-24 06:39:07 richard Exp $
18+
#$Id: back_anydbm.py,v 1.158 2004-06-28 23:13:05 richard Exp $
1919
'''This module defines a backend that saves the hyperdatabase in a
2020
database chosen by anydbm. It is guaranteed to always be available in python
2121
versions >2.1.1 (the dumbdbm fallback in 2.1.1 and earlier has several
@@ -2166,15 +2166,29 @@ def set(self, itemid, **propvalues):
21662166
return propvalues
21672167

21682168
def getprops(self, protected=1):
2169-
''' In addition to the actual properties on the node, these methods
2170-
provide the "content" property. If the "protected" flag is true,
2171-
we include protected properties - those which may not be
2172-
modified.
2169+
'''In addition to the actual properties on the node, these methods
2170+
provide the "content" property. If the "protected" flag is true,
2171+
we include protected properties - those which may not be
2172+
modified.
2173+
2174+
Note that the content prop is indexed separately, hence no indexme.
21732175
'''
21742176
d = Class.getprops(self, protected=protected).copy()
21752177
d['content'] = hyperdb.String()
21762178
return d
21772179

2180+
def index(self, nodeid):
2181+
'''Add (or refresh) the node to search indexes.
2182+
2183+
Pass on the content-type property for the content property.
2184+
'''
2185+
Class.index(self, nodeid)
2186+
mimetype = self.get(nodeid, 'type')
2187+
if not mimetype:
2188+
mimetype = self.default_mime_type
2189+
self.db.indexer.add_text((self.classname, nodeid, 'content'),
2190+
self.get(nodeid, 'content'), mimetype)
2191+
21782192
# deviation from spec - was called ItemClass
21792193
class IssueClass(Class, roundupdb.IssueClass):
21802194
# Overridden methods:

roundup/backends/back_metakit.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: back_metakit.py,v 1.76 2004-06-24 09:57:49 richard Exp $
1+
# $Id: back_metakit.py,v 1.77 2004-06-28 23:13:05 richard Exp $
22
'''Metakit backend for Roundup, originally by Gordon McMillan.
33
44
Known Current Bugs:
@@ -1946,6 +1946,10 @@ def undo(fnm=nm):
19461946
self.fireReactors('set', oldnode, propvalues)
19471947

19481948
def index(self, nodeid):
1949+
'''Add (or refresh) the node to search indexes.
1950+
1951+
Pass on the content-type property for the content property.
1952+
'''
19491953
Class.index(self, nodeid)
19501954
mimetype = self.get(nodeid, 'type')
19511955
if not mimetype:

roundup/backends/rdbms_common.py

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: rdbms_common.py,v 1.112 2004-06-24 06:39:07 richard Exp $
1+
# $Id: rdbms_common.py,v 1.113 2004-06-28 23:13:05 richard Exp $
22
''' Relational database (SQL) backend common code.
33
44
Basics:
@@ -2426,7 +2426,10 @@ def import_list(self, propnames, proplist):
24262426
# make the new node's property map
24272427
d = {}
24282428
retire = 0
2429-
newid = None
2429+
if not "id" in propnames:
2430+
newid = self.db.newid(self.classname)
2431+
else:
2432+
newid = eval(proplist[propnames.index("id")])
24302433
for i in range(len(propnames)):
24312434
# Use eval to reverse the repr() used to output the CSV
24322435
value = eval(proplist[i])
@@ -2436,7 +2439,6 @@ def import_list(self, propnames, proplist):
24362439

24372440
# "unmarshal" where necessary
24382441
if propname == 'id':
2439-
newid = value
24402442
continue
24412443
elif propname == 'is retired':
24422444
# is the item retired?
@@ -2460,6 +2462,11 @@ def import_list(self, propnames, proplist):
24602462
pwd.unpack(value)
24612463
value = pwd
24622464
d[propname] = value
2465+
if isinstance(prop, String) and prop.indexme:
2466+
if type(value) != type('') and type(value) != type(u''):
2467+
raise TypeError, 'new property "%s" not a string'%key
2468+
self.db.indexer.add_text((self.classname, newid, propname),
2469+
value)
24632470

24642471
# get a new id if necessary
24652472
if newid is None:
@@ -2600,10 +2607,12 @@ def get(self, nodeid, propname, default=_marker, cache=1):
26002607
return Class.get(self, nodeid, propname)
26012608

26022609
def getprops(self, protected=1):
2603-
''' In addition to the actual properties on the node, these methods
2604-
provide the "content" property. If the "protected" flag is true,
2605-
we include protected properties - those which may not be
2606-
modified.
2610+
'''In addition to the actual properties on the node, these methods
2611+
provide the "content" property. If the "protected" flag is true,
2612+
we include protected properties - those which may not be
2613+
modified.
2614+
2615+
Note that the content prop is indexed separately, hence no indexme.
26072616
'''
26082617
d = Class.getprops(self, protected=protected).copy()
26092618
d['content'] = hyperdb.String()
@@ -2638,6 +2647,18 @@ def set(self, itemid, **propvalues):
26382647
self.fireReactors('set', itemid, oldvalues)
26392648
return propvalues
26402649

2650+
def index(self, nodeid):
2651+
'''Add (or refresh) the node to search indexes.
2652+
2653+
Pass on the content-type property for the content property.
2654+
'''
2655+
Class.index(nodeid)
2656+
mime_type = self.get(itemid, 'type')
2657+
if not mime_type:
2658+
mime_type = self.default_mime_type
2659+
self.db.indexer.add_text((self.classname, nodeid, 'content'),
2660+
str(self.get(nodeid, 'content')), mime_type)
2661+
26412662
# XXX deviation from spec - was called ItemClass
26422663
class IssueClass(Class, roundupdb.IssueClass):
26432664
# Overridden methods:

test/db_test_base.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: db_test_base.py,v 1.34 2004-06-24 06:39:07 richard Exp $
18+
# $Id: db_test_base.py,v 1.35 2004-06-28 23:13:06 richard Exp $
1919

2020
import unittest, os, shutil, errno, imp, sys, time, pprint
2121

@@ -703,7 +703,6 @@ def testFileClassReindexing(self):
703703
self.assertEquals(self.db.indexer.search(['hello'], self.db.issue),
704704
{i1: {'files': [f2]}})
705705

706-
707706
def testForcedReindexing(self):
708707
self.db.issue.create(title="flebble frooz")
709708
self.db.commit()

0 commit comments

Comments
 (0)