Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #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)
Пример #9
0
def reindex_documents():
    for id in DocumentType.get_indexable():
        DocumentType.index(DocumentType.extract_document(id), id)
Пример #10
0
def reindex_documents():
    for id in DocumentType.get_indexable():
        DocumentType.index(DocumentType.extract_document(id), id)
Пример #11
0
 def test_hidden_slugs_should_update(self):
     jezdez_doc = Document.objects.get(slug='User:jezdez')
     eq_(DocumentType.should_update(jezdez_doc), False)
Пример #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)
Пример #13
0
 def test_hidden_slugs_should_update(self):
     jezdez_doc = Document.objects.get(slug='User:jezdez')
     eq_(DocumentType.should_update(jezdez_doc), False)
Пример #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)