1 # ====================================================================
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
6 # http://www.apache.org/licenses/LICENSE-2.0
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13 # ====================================================================
18 class Test_Bug1564(unittest.TestCase):
22 self.analyzer = StandardAnalyzer(Version.LUCENE_CURRENT)
23 self.store = RAMDirectory()
25 writer = IndexWriter(self.store, self.analyzer, True,
26 IndexWriter.MaxFieldLength.LIMITED)
28 doc.add(Field('all', u'windowpane beplaster rapacious \
29 catatonia gauntlet wynn depressible swede pick dressmake supreme \
30 jeremy plumb theoretic bureaucracy causation chartres equipoise \
31 dispersible careen heard',
32 Field.Store.NO, Field.Index.ANALYZED))
33 doc.add(Field('id', '1', Field.Store.YES, Field.Index.NO))
34 writer.addDocument(doc)
41 def test_bug1564(self):
43 searcher = IndexSearcher(self.store, True)
44 query = QueryParser(Version.LUCENE_CURRENT, 'all',
45 self.analyzer).parse('supreme')
46 topDocs = searcher.search(query, 50)
47 self.assertEqual(topDocs.totalHits, 1)
50 if __name__ == '__main__':