From ac5ab6544bcbaecc0cc08aa192b867d4c4e1e9af Mon Sep 17 00:00:00 2001 From: clime Date: Thu, 21 Apr 2016 08:46:46 +0200 Subject: [PATCH] default value of order_by_relevance param set to 10, also fixed some typos in comments --- flask_whooshee.py | 2 +- test.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/flask_whooshee.py b/flask_whooshee.py index 4164b62..6a32fb2 100644 --- a/flask_whooshee.py +++ b/flask_whooshee.py @@ -19,7 +19,7 @@ class WhoosheeQuery(BaseQuery): # TODO: add an option to override used Whoosheer def whooshee_search(self, search_string, group=whoosh.qparser.OrGroup, - match_substrings=True, limit=None, order_by_relevance=-1): + match_substrings=True, limit=None, order_by_relevance=10): """Do a fulltext search on the query. Args: diff --git a/test.py b/test.py index ba62366..e16a034 100644 --- a/test.py +++ b/test.py @@ -159,7 +159,7 @@ class BaseTestCases(object): search_string = u' '.join([string.ascii_lowercase[i]*3 for i in range(26)]) - # no sorting (this assumes (hopes) rows won't returned in the correct order by default) + # no sorting (this assumes (hopes) rows won't be returned in the correct order by default) found_entries = self.Entry.query.whooshee_search(search_string, order_by_relevance=0).all() titles = [int(entry.title) for entry in found_entries] self.assertNotEqual(titles, sorted(titles, reverse=True)) @@ -169,7 +169,7 @@ class BaseTestCases(object): titles = [int(entry.title) for entry in found_entries] self.assertEqual(titles, sorted(titles, reverse=True)) - # sort some (this assumes (hopes) the rest of the rows won't returned in the correct order by default) + # sort some (this assumes (hopes) the rest of the rows won't be returned in the correct order by default) found_entries = self.Entry.query.whooshee_search(search_string, order_by_relevance=20).all() titles = [int(entry.title) for entry in found_entries] self.assertNotEqual(titles, sorted(titles, reverse=True))