You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by as...@apache.org on 2014/03/03 11:18:49 UTC
svn commit: r1573509 -
/bloodhound/trunk/bloodhound_search/bhsearch/tests/api.py
Author: astaric
Date: Mon Mar 3 10:18:49 2014
New Revision: 1573509
URL: http://svn.apache.org/r1573509
Log:
Test for search index rebuild with documents without product. Refs: #773
Modified:
bloodhound/trunk/bloodhound_search/bhsearch/tests/api.py
Modified: bloodhound/trunk/bloodhound_search/bhsearch/tests/api.py
URL: http://svn.apache.org/viewvc/bloodhound/trunk/bloodhound_search/bhsearch/tests/api.py?rev=1573509&r1=1573508&r2=1573509&view=diff
==============================================================================
--- bloodhound/trunk/bloodhound_search/bhsearch/tests/api.py (original)
+++ bloodhound/trunk/bloodhound_search/bhsearch/tests/api.py Mon Mar 3 10:18:49 2014
@@ -18,12 +18,14 @@
# under the License.
import shutil
-from bhsearch.api import BloodhoundSearchApi, ASC, SortInstruction
+from bhsearch.api import BloodhoundSearchApi, ASC, SortInstruction, IIndexParticipant, IndexFields
from bhsearch.query_parser import DefaultQueryParser
+from bhsearch.search_resources.base import BaseIndexer
from bhsearch.search_resources.ticket_search import TicketSearchParticipant
from bhsearch.tests import unittest
from bhsearch.tests.base import BaseBloodhoundSearchTest
from bhsearch.whoosh_backend import WhooshBackend
+from trac.core import implements, ComponentMeta
class ApiQueryWithWhooshTestCase(BaseBloodhoundSearchTest):
@@ -131,6 +133,28 @@ class ApiQueryWithWhooshTestCase(BaseBlo
self.assertEqual(results.hits, 2)
+ def test_upgrade_index_with_no_product(self):
+ """See #773"""
+
+ class NoProductIndexer(BaseIndexer):
+ implements(IIndexParticipant)
+
+ def get_entries_for_index(self):
+ yield {
+ IndexFields.TYPE: 'noproduct',
+ IndexFields.ID: '1'
+ }
+
+ self.search_api.rebuild_index()
+
+ self.unregister(NoProductIndexer)
+
+ @staticmethod
+ def unregister(component):
+ ComponentMeta._components.remove(component)
+ for interface in component.__dict__.get('_implements', ()):
+ ComponentMeta._registry.get(interface).remove(component)
+
#TODO: check this later
# @unittest.skip("Check with Whoosh community")
# def test_can_search_id_and_summary(self):