mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-02 17:29:22 +01:00
Fixed search to put the word between stars if it doesn't have any globbing metachacters.
This commit is contained in:
parent
1879f0786d
commit
657df52ea3
@ -384,6 +384,8 @@ class Factoids(plugins.ChannelDBHandler, callbacks.Privmsg):
|
|||||||
db.create_function(predicateName, 1, p)
|
db.create_function(predicateName, 1, p)
|
||||||
predicateName += 'p'
|
predicateName += 'p'
|
||||||
for glob in rest:
|
for glob in rest:
|
||||||
|
if '*' not in glob and '?' not in glob:
|
||||||
|
glob = '*%s*' % glob
|
||||||
criteria.append('key LIKE %s')
|
criteria.append('key LIKE %s')
|
||||||
formats.append(glob.translate(self._sqlTrans))
|
formats.append(glob.translate(self._sqlTrans))
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
|
@ -93,6 +93,8 @@ if sqlite is not None:
|
|||||||
'inkedmn.*strike|strike.*inkedmn')
|
'inkedmn.*strike|strike.*inkedmn')
|
||||||
self.assertRegexp('search *ke*',
|
self.assertRegexp('search *ke*',
|
||||||
'inkedmn.*strike|strike.*inkedmn')
|
'inkedmn.*strike|strike.*inkedmn')
|
||||||
|
self.assertRegexp('search ke',
|
||||||
|
'inkedmn.*strike|strike.*inkedmn')
|
||||||
|
|
||||||
|
|
||||||
def testNotZeroIndexed(self):
|
def testNotZeroIndexed(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user