From 12368ddca84ff5a531d152642c95e95f1b80d555 Mon Sep 17 00:00:00 2001 From: Andrew Ekstedt Date: Tue, 11 Mar 2014 18:21:08 -0700 Subject: [PATCH] Whoosh 2.5 performance quickfix In Whoosh 2.5, fields that can be sorted on need to specify sortable=True or else take a large performance hit because whoosh completely dumped its old method of speeding up sorting (automatic caching) in favor of this brand new one. These probably don't *all* need to be sortable, but hey. Note that we now require Whoosh>=2.5 because the sortable keyword arg didn't exist in exist in earlier versions. --- pokedex/lookup.py | 10 +++++----- setup.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pokedex/lookup.py b/pokedex/lookup.py index 6d55aae..0cd813a 100644 --- a/pokedex/lookup.py +++ b/pokedex/lookup.py @@ -171,12 +171,12 @@ class PokedexLookup(object): """Creates the index from scratch.""" schema = whoosh.fields.Schema( - name=whoosh.fields.ID(stored=True, spelling=True), - table=whoosh.fields.ID(stored=True), - row_id=whoosh.fields.ID(stored=True), + name=whoosh.fields.ID(sortable=True, stored=True, spelling=True), + table=whoosh.fields.ID(sortable=True, stored=True), + row_id=whoosh.fields.ID(sortable=True, stored=True), language=whoosh.fields.STORED, - iso639=whoosh.fields.ID(stored=True), - iso3166=whoosh.fields.ID(stored=True), + iso639=whoosh.fields.ID(sortable=True, stored=True), + iso3166=whoosh.fields.ID(sortable=True, stored=True), display_name=whoosh.fields.STORED, # non-lowercased name ) diff --git a/setup.py b/setup.py index a2cef50..5570bc9 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ setup( }, install_requires=[ 'SQLAlchemy>=0.7.3', - 'whoosh>=2.2.2', + 'whoosh>=2.5', 'markdown', 'construct', ],