X-Git-Url: http://git.veekun.com/zzz-pokedex.git/blobdiff_plain/7323dd76007f16915391386822a7bd8a3a58ebab..5ed0ed3118bcd848f4d9533fc00baf3afbef4322:/pokedex/lookup.py?ds=sidebyside diff --git a/pokedex/lookup.py b/pokedex/lookup.py index b00f5a7..0b09823 100644 --- a/pokedex/lookup.py +++ b/pokedex/lookup.py @@ -1,5 +1,4 @@ # encoding: utf8 -from collections import namedtuple import os, os.path import random import re @@ -15,6 +14,8 @@ from whoosh.qparser import QueryParser 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 @@ -448,6 +449,8 @@ class PokedexLookup(object): 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