From ccd40c15d493061d2cde91abdcaca74756acb6eb Mon Sep 17 00:00:00 2001 From: Dave Dash Date: Fri, 4 Feb 2011 15:37:29 -0800 Subject: [PATCH] bug 629314, Don't index disabled personas. --- apps/search/tests/test_client.py | 9 ++++++++- configs/sphinx/sphinx.conf | 4 +++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/search/tests/test_client.py b/apps/search/tests/test_client.py index d233e89cb4..8e44a9f80e 100644 --- a/apps/search/tests/test_client.py +++ b/apps/search/tests/test_client.py @@ -256,7 +256,7 @@ class SearchTest(SphinxTestCase): class SearchStatusTest(SphinxTestCase): fixtures = ('base/addon_3615', 'base/addon_5369', 'base/addon_592', 'base/addon_5579', 'base/addon_40', 'search/560618-alpha-sort', - 'base/apps', 'base/category') + 'base/apps', 'base/category', 'addons/persona') def reindex(self): stop_sphinx() @@ -269,6 +269,13 @@ class SearchStatusTest(SphinxTestCase): self.reindex() eq_(len(query('')), 0) + def test_persona_status(self): + Addon.objects.update(status=amo.STATUS_PUBLIC) + eq_(len(pquery('')), 1) + Addon.objects.update(status=amo.STATUS_DISABLED) + self.reindex() + eq_(len(pquery('')), 0) + def test_searchable_status(self): Addon.objects.update(status=amo.STATUS_UNREVIEWED) Addon.objects.filter(id=5579).update(status=amo.STATUS_PUBLIC) diff --git a/configs/sphinx/sphinx.conf b/configs/sphinx/sphinx.conf index e675ae258a..bdd895967f 100755 --- a/configs/sphinx/sphinx.conf +++ b/configs/sphinx/sphinx.conf @@ -301,7 +301,9 @@ source personas OR name.localized_string IS NOT NULL \ OR description.locale IS NOT NULL \ OR description.localized_string IS NOT NULL \ - ) + )\ + AND status IN (4, 8, 9) -- PUBLIC, LITE, LITE_AND_NOMINATED + sql_attr_uint = addon_id sql_attr_uint = locale_ord sql_attr_str2ordinal = locale