Fixed search to put the word between stars if it doesn't have any globbing metachacters.

This commit is contained in:
Jeremy Fincher 2003-10-22 15:15:50 +00:00
parent 1879f0786d
commit 657df52ea3
2 changed files with 4 additions and 0 deletions

View File

@ -384,6 +384,8 @@ class Factoids(plugins.ChannelDBHandler, callbacks.Privmsg):
db.create_function(predicateName, 1, p)
predicateName += 'p'
for glob in rest:
if '*' not in glob and '?' not in glob:
glob = '*%s*' % glob
criteria.append('key LIKE %s')
formats.append(glob.translate(self._sqlTrans))
cursor = db.cursor()

View File

@ -93,6 +93,8 @@ if sqlite is not None:
'inkedmn.*strike|strike.*inkedmn')
self.assertRegexp('search *ke*',
'inkedmn.*strike|strike.*inkedmn')
self.assertRegexp('search ke',
'inkedmn.*strike|strike.*inkedmn')
def testNotZeroIndexed(self):