Mercurial > p > roundup > code
comparison test/db_test_base.py @ 2872:d530b68e4b42
don't index common words [SF#1046612]
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Fri, 05 Nov 2004 05:10:07 +0000 |
| parents | da2a9175eb83 |
| children | 09a4d6dd6dcb |
comparison
equal
deleted
inserted
replaced
| 2870:795cdba40c05 | 2872:d530b68e4b42 |
|---|---|
| 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 17 # | 17 # |
| 18 # $Id: db_test_base.py,v 1.51 2004-10-24 09:57:32 a1s Exp $ | 18 # $Id: db_test_base.py,v 1.52 2004-11-05 05:10:07 richard Exp $ |
| 19 | 19 |
| 20 import unittest, os, shutil, errno, imp, sys, time, pprint | 20 import unittest, os, shutil, errno, imp, sys, time, pprint |
| 21 | 21 |
| 22 from roundup.hyperdb import String, Password, Link, Multilink, Date, \ | 22 from roundup.hyperdb import String, Password, Link, Multilink, Date, \ |
| 23 Interval, DatabaseError, Boolean, Number, Node | 23 Interval, DatabaseError, Boolean, Number, Node |
| 682 f1 = self.db.file.create(content='hello', type="text/plain") | 682 f1 = self.db.file.create(content='hello', type="text/plain") |
| 683 # content='world' has the wrong content-type and won't be indexed | 683 # content='world' has the wrong content-type and won't be indexed |
| 684 f2 = self.db.file.create(content='world', type="text/frozz", | 684 f2 = self.db.file.create(content='world', type="text/frozz", |
| 685 comment='blah blah') | 685 comment='blah blah') |
| 686 i1 = self.db.issue.create(files=[f1, f2], title="flebble plop") | 686 i1 = self.db.issue.create(files=[f1, f2], title="flebble plop") |
| 687 i2 = self.db.issue.create(title="flebble frooz") | 687 i2 = self.db.issue.create(title="flebble the frooz") |
| 688 self.db.commit() | 688 self.db.commit() |
| 689 self.assertEquals(self.db.indexer.search(['hello'], self.db.issue), | 689 self.assertEquals(self.db.indexer.search(['hello'], self.db.issue), |
| 690 {i1: {'files': [f1]}}) | 690 {i1: {'files': [f1]}}) |
| 691 self.assertEquals(self.db.indexer.search(['world'], self.db.issue), {}) | 691 self.assertEquals(self.db.indexer.search(['world'], self.db.issue), {}) |
| 692 self.assertEquals(self.db.indexer.search(['frooz'], self.db.issue), | 692 self.assertEquals(self.db.indexer.search(['frooz'], self.db.issue), |
| 693 {i2: {}}) | 693 {i2: {}}) |
| 694 self.assertEquals(self.db.indexer.search(['flebble'], self.db.issue), | 694 self.assertEquals(self.db.indexer.search(['flebble'], self.db.issue), |
| 695 {i1: {}, i2: {}}) | 695 {i1: {}, i2: {}}) |
| 696 | |
| 697 # unindexed stopword | |
| 698 self.assertEquals(self.db.indexer.search(['the'], self.db.issue), {}) | |
| 696 | 699 |
| 697 def testReindexing(self): | 700 def testReindexing(self): |
| 698 search = self.db.indexer.search | 701 search = self.db.indexer.search |
| 699 issue = self.db.issue | 702 issue = self.db.issue |
| 700 i1 = issue.create(title="flebble plop") | 703 i1 = issue.create(title="flebble plop") |
