comparison test/test_indexer.py @ 6908:3260926d7e7e

fix postgresl-fts indexer: get_indexer reported not implemented When I implemented postgresql fts indexing I forgot to remove code that raised NotImplemented when it was requested. Also had to fix import to match filename. Added tests for native-fts paths in get_indexer.
author John Rouillard <rouilj@ieee.org>
date Sat, 03 Sep 2022 17:58:41 -0400
parents 0d99ae7c8de6
children 86cde9cae7e1
comparison
equal deleted inserted replaced
6907:551fec9c4cfc 6908:3260926d7e7e
239 239
240 def tearDown(self): 240 def tearDown(self):
241 RDBMSIndexerTest.tearDown(self) 241 RDBMSIndexerTest.tearDown(self)
242 postgresqlOpener.tearDown(self) 242 postgresqlOpener.tearDown(self)
243 243
244 def test_get_indexer(self):
245 def class_name_of(object):
246 """ take and object and return just the class name.
247 So in:
248
249 return the class name before "at".
250
251 """
252 return(str(object).split()[0])
253
254 from roundup.backends.indexer_common import get_indexer
255 old_indexer = self.db.config['INDEXER']
256 self.db.config['INDEXER'] = 'native-fts'
257
258 get_indexer(self.db.config, self.db)
259
260 self.assertEqual(class_name_of(self.dex),
261 class_name_of(get_indexer(self.db.config, self.db)))
262
263 self.db.config['INDEXER'] = old_indexer
264
244 def test_websearch_syntax(self): 265 def test_websearch_syntax(self):
245 """Test searches using websearch_to_tsquery. These never throw 266 """Test searches using websearch_to_tsquery. These never throw
246 errors regardless of how wacky the input. 267 errors regardless of how wacky the input.
247 """ 268 """
248 269
454 RDBMSIndexerTest.setUp(self) 475 RDBMSIndexerTest.setUp(self)
455 from roundup.backends.indexer_sqlite_fts import Indexer 476 from roundup.backends.indexer_sqlite_fts import Indexer
456 self.dex = Indexer(self.db) 477 self.dex = Indexer(self.db)
457 self.dex.db = self.db 478 self.dex.db = self.db
458 479
480 def test_get_indexer(self):
481 def class_name_of(object):
482 """ take and object and return just the class name.
483 So in:
484
485 return the class name before "at".
486
487 """
488 return(str(object).split()[0])
489
490 from roundup.backends.indexer_common import get_indexer
491 old_indexer = 'native-fts'
492 self.db.config['INDEXER'] = 'native-fts'
493
494 get_indexer(self.db.config, self.db)
495
496 self.assertEqual(class_name_of(self.dex),
497 class_name_of(get_indexer(self.db.config, self.db)))
498
499 self.db.config['INDEXER'] = old_indexer
500
459 def test_phrase_and_near(self): 501 def test_phrase_and_near(self):
460 self.dex.add_text(('test', '1', 'foo'), 'a the hello world') 502 self.dex.add_text(('test', '1', 'foo'), 'a the hello world')
461 self.dex.add_text(('test', '2', 'foo'), 'helh blah blah the world') 503 self.dex.add_text(('test', '2', 'foo'), 'helh blah blah the world')
462 self.dex.add_text(('test', '3', 'foo'), 'blah hello the world') 504 self.dex.add_text(('test', '3', 'foo'), 'blah hello the world')
463 self.dex.add_text(('test', '4', 'foo'), 'hello blah blech the world') 505 self.dex.add_text(('test', '4', 'foo'), 'hello blah blech the world')

Roundup Issue Tracker: http://roundup-tracker.org/