mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
added search-hook for plugins using "search" scope
This commit is contained in:
parent
ff82aad50f
commit
b07254cb09
1 changed files with 6 additions and 0 deletions
|
@ -5,6 +5,7 @@
|
|||
import re
|
||||
from anki.utils import ids2str, splitFields, joinFields, intTime
|
||||
from anki.consts import *
|
||||
from anki.hooks import *
|
||||
import sre_constants
|
||||
|
||||
# Find
|
||||
|
@ -27,6 +28,10 @@ class Finder(object):
|
|||
self.search['rated'] = self._findRated
|
||||
self.search['tag'] = self._findTag
|
||||
|
||||
|
||||
def _loadSearchHookPlugins(self):
|
||||
runHook("search", self.search)
|
||||
|
||||
def findCards(self, query, order=False):
|
||||
"Return a list of card ids for QUERY."
|
||||
tokens = self._tokenize(query)
|
||||
|
@ -120,6 +125,7 @@ select distinct(n.id) from cards c, notes n where c.nid=n.id and """+preds
|
|||
######################################################################
|
||||
|
||||
def _where(self, tokens):
|
||||
self._loadSearchHookPlugins()
|
||||
# state and query
|
||||
s = dict(isnot=False, isor=False, join=False, q="", bad=False)
|
||||
args = []
|
||||
|
|
Loading…
Reference in a new issue