예제 #1
0
    def test_exclude_words(self):
        """Excluding words with -word works."""
        results = list(wiki_search.query('spanish'))
        eq_(1, len(results))

        results = list(wiki_search.query('spanish -content'))
        eq_(0, len(results))
예제 #2
0
    def test_no_syntax_error(self):
        """Test that special chars cannot cause a syntax error."""
        results = list(wiki_search.query('video^$'))
        eq_(1, len(results))

        results = list(wiki_search.query('video^^^$$$^'))
        eq_(1, len(results))

        results = list(wiki_search.query('google.com/ig'))
        eq_(0, len(results))
예제 #3
0
 def test_no_filter(self):
     """Test searching with no filters."""
     # Note: We keep the query('') here to force a new S and thus
     # not inadvertently test with an S that's not in an original
     # state.
     results = list(wiki_search.query(''))
     eq_(6, len(results))
예제 #4
0
 def test_indexer(self):
     results = wiki_search.query('audio')
     eq_(2, len(results))
예제 #5
0
 def test_no_redirects(self):
     """Redirect articles should never appear in search results."""
     results = list(wiki_search.query('ghosts'))
     eq_(1, len(results))
예제 #6
0
 def test_clean_hyphens(self):
     """Hyphens in words aren't special characters."""
     results = list(wiki_search.query('marque-page'))
     eq_(1, len(results))
예제 #7
0
 def test_ngram_chars(self):
     """Ideographs are handled correctly."""
     results = list(wiki_search.query(u'\u30c1'))
     eq_(1, len(results))
     eq_(2, results[0].id)
예제 #8
0
 def test_wiki_index_strip_html(self):
     """HTML should be stripped, not indexed."""
     results = list(wiki_search.query('strong'))
     eq_(0, len(results))
예제 #9
0
 def test_wiki_index_content(self):
     """Obviously the content should be indexed."""
     results = list(wiki_search.query('video'))
     eq_(1, len(results))
     eq_(1, results[0].id)
예제 #10
0
 def test_wiki_index_summary(self):
     """The summary field of a revision is indexed."""
     results = list(wiki_search.query('whatever'))
     eq_(1, len(results))
     eq_(3, results[0].id)
예제 #11
0
 def test_wiki_index_keywords(self):
     """The keywords field of a revision is indexed."""
     results = list(wiki_search.query('foobar'))
     eq_(1, len(results))
     eq_(3, results[0].id)