projects
/
zzz-pokedex.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fuzzy lookup results were not respecting type limits.
[zzz-pokedex.git]
/
pokedex
/
lookup.py
diff --git
a/pokedex/lookup.py
b/pokedex/lookup.py
index
b00f5a7
..
0b09823
100644
(file)
--- a/
pokedex/lookup.py
+++ b/
pokedex/lookup.py
@@
-1,5
+1,4
@@
# encoding: utf8
# encoding: utf8
-from collections import namedtuple
import os, os.path
import random
import re
import os, os.path
import random
import re
@@
-15,6
+14,8
@@
from whoosh.qparser import QueryParser
import whoosh.scoring
import whoosh.spelling
import whoosh.scoring
import whoosh.spelling
+from pokedex.util import namedtuple
+
from pokedex.db import connect
import pokedex.db.tables as tables
from pokedex.roomaji import romanize
from pokedex.db import connect
import pokedex.db.tables as tables
from pokedex.roomaji import romanize
@@
-448,6
+449,8
@@
class PokedexLookup(object):
name, self.INTERMEDIATE_LOOKUP_RESULTS):
query = whoosh.query.Term('name', suggestion)
name, self.INTERMEDIATE_LOOKUP_RESULTS):
query = whoosh.query.Term('name', suggestion)
+ if type_term:
+ query = query & type_term
results.extend(searcher.search(query))
### Convert results to db objects
results.extend(searcher.search(query))
### Convert results to db objects