Exemplo n.º 1
0
 def test_current_locale_results(self):
     self.refresh()
     results = (DocumentType.search().query(or_={
         'title': 'article',
         'content': 'article'
     }).filter(locale='en-US').highlight('content'))
     for doc in results:
         eq_('en-US', doc.locale)
Exemplo n.º 2
0
 def test_current_locale_results(self):
     self.refresh()
     results = (DocumentType.search().query(or_={'title': 'article',
                                                 'content': 'article'})
                                     .filter(locale='en-US')
                                     .highlight('content'))
     for doc in results:
         eq_('en-US', doc.locale)
Exemplo n.º 3
0
 def test_get_excerpt_uses_summary(self):
     self.refresh()
     results = (DocumentType.search().query(content__match='audio')
                                     .highlight('content'))
     ok_(results.count() > 0)
     for doc in results:
         excerpt = doc.get_excerpt()
         ok_('the word for tough things' in excerpt)
         ok_('extra content' not in excerpt)
Exemplo n.º 4
0
 def test_get_excerpt_strips_html(self):
     self.refresh()
     results = (DocumentType.search().query(content__match='audio')
                                     .highlight('content'))
     ok_(results.count() > 0)
     for doc in results:
         excerpt = doc.get_excerpt()
         ok_('audio' in excerpt)
         ok_('<strong>' not in excerpt)
Exemplo n.º 5
0
 def test_get_excerpt_uses_summary(self):
     self.refresh()
     results = (DocumentType.search().query(
         content__match='audio').highlight('content'))
     ok_(results.count() > 0)
     for doc in results:
         excerpt = doc.get_excerpt()
         ok_('the word for tough things' in excerpt)
         ok_('extra content' not in excerpt)
Exemplo n.º 6
0
 def test_get_excerpt_strips_html(self):
     self.refresh()
     results = (DocumentType.search().query(
         content__match='audio').highlight('content'))
     ok_(results.count() > 0)
     for doc in results:
         excerpt = doc.get_excerpt()
         ok_('audio' in excerpt)
         ok_('<strong>' not in excerpt)
Exemplo n.º 7
0
    def test_get_excerpt_without_highlight_match(self):
        self.refresh()
        results = (DocumentType.search().query(or_={'title': 'lorem',
                                                    'content': 'lorem'})
                                        .highlight('content'))

        ok_(results.count() > 0)
        for doc in results:
            excerpt = doc.get_excerpt()
            eq_('audio is in this but the word for tough things'
                ' will be ignored', excerpt)
Exemplo n.º 8
0
    def test_get_excerpt_without_highlight_match(self):
        self.refresh()
        results = (DocumentType.search().query(or_={
            'title': 'lorem',
            'content': 'lorem'
        }).highlight('content'))

        ok_(results.count() > 0)
        for doc in results:
            excerpt = doc.get_excerpt()
            eq_(
                'audio is in this but the word for tough things'
                ' will be ignored', excerpt)
Exemplo n.º 9
0
Arquivo: cron.py Projeto: psbots/kuma
def reindex_documents():
    for id in DocumentType.get_indexable():
        DocumentType.index(DocumentType.extract_document(id), id)
Exemplo n.º 10
0
def reindex_documents():
    for id in DocumentType.get_indexable():
        DocumentType.index(DocumentType.extract_document(id), id)
Exemplo n.º 11
0
 def test_hidden_slugs_should_update(self):
     jezdez_doc = Document.objects.get(slug='User:jezdez')
     eq_(DocumentType.should_update(jezdez_doc), False)
Exemplo n.º 12
0
 def test_hidden_slugs_get_indexable(self):
     self.refresh()
     title_list = DocumentType.get_indexable().values_list('title', flat=True)
     ok_('User:jezdez' not in title_list)
Exemplo n.º 13
0
 def test_hidden_slugs_should_update(self):
     jezdez_doc = Document.objects.get(slug='User:jezdez')
     eq_(DocumentType.should_update(jezdez_doc), False)
Exemplo n.º 14
0
 def test_hidden_slugs_get_indexable(self):
     self.refresh()
     title_list = DocumentType.get_indexable().values_list('title',
                                                           flat=True)
     ok_('User:jezdez' not in title_list)