Skip to content

Commit 3a2f2f8

Browse files
author
Erik Forsberg
committed
Fix for [SF#698136] Trouble with full-text indexer, with test.
1 parent 703c61e commit 3a2f2f8

File tree

2 files changed

+49
-4
lines changed

2 files changed

+49
-4
lines changed

roundup/backends/rdbms_common.py

Lines changed: 2 additions & 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: rdbms_common.py,v 1.184 2007-04-01 18:48:06 forsberg Exp $
18+
#$Id: rdbms_common.py,v 1.185 2007-04-11 20:04:06 forsberg Exp $
1919
""" Relational database (SQL) backend common code.
2020
2121
Basics:
@@ -2636,7 +2636,7 @@ def getprops(self, protected=1):
26362636
Note that the content prop is indexed separately, hence no indexme.
26372637
"""
26382638
d = Class.getprops(self, protected=protected).copy()
2639-
d['content'] = hyperdb.String()
2639+
d['content'] = hyperdb.String(indexme='yes')
26402640
return d
26412641

26422642
def set(self, itemid, **propvalues):

test/db_test_base.py

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
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.84 2007-03-14 15:23:11 schlatterbeck Exp $
18+
# $Id: db_test_base.py,v 1.85 2007-04-11 20:04:06 forsberg Exp $
1919

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

2222
from roundup.hyperdb import String, Password, Link, Multilink, Date, \
2323
Interval, DatabaseError, Boolean, Number, Node
24-
from roundup import date, password, init, instance, configuration
24+
from roundup import date, password, init, instance, configuration, support
2525

2626
from mocknull import MockNull
2727

@@ -879,6 +879,51 @@ def testForcedReindexing(self):
879879
self.assertEquals(self.db.indexer.search(['flebble'], self.db.issue),
880880
{'1': {}})
881881

882+
def testIndexingOnImport(self):
883+
msgcontent = 'Glrk'
884+
msgid = self.db.msg.import_list(['content'], [repr(msgcontent)])
885+
msg_filename = self.db.filename(self.db.msg.classname, msgid,
886+
create=1)
887+
support.ensureParentsExist(msg_filename)
888+
msg_file = open(msg_filename, 'w')
889+
msg_file.write(msgcontent)
890+
msg_file.close()
891+
892+
893+
filecontent = 'Brrk'
894+
fileid = self.db.file.import_list(['content'], [repr(filecontent)])
895+
file_filename = self.db.filename(self.db.file.classname, fileid,
896+
create=1)
897+
support.ensureParentsExist(file_filename)
898+
file_file = open(file_filename, 'w')
899+
file_file.write(filecontent)
900+
file_file.close()
901+
902+
title = 'Bzzt'
903+
nodeid = self.db.issue.import_list(['title', 'messages', 'files',
904+
'spam',
905+
'nosy',
906+
'superseder'],
907+
[repr(title),
908+
repr([msgid]),
909+
repr([fileid]),
910+
repr([]),
911+
repr([]),
912+
repr([])])
913+
self.db.commit()
914+
915+
# Content of title attribute is indexed
916+
self.assertEquals(self.db.indexer.search([title], self.db.issue),
917+
{str(nodeid):{}})
918+
# Content of message is indexed
919+
self.assertEquals(self.db.indexer.search([msgcontent], self.db.issue),
920+
{str(nodeid):{'messages':[str(msgid)]}})
921+
# Content of file is indexed
922+
self.assertEquals(self.db.indexer.search([filecontent], self.db.issue),
923+
{str(nodeid):{'files':[str(fileid)]}})
924+
925+
926+
882927
#
883928
# searching tests follow
884929
#

0 commit comments

Comments
 (0)