Exemplo n.º 1
0
    def test__select(self):
        # Short params.
        resp_body = self.solr._select({'q': 'doc'})
        resp_data = json.loads(resp_body)
        self.assertEqual(resp_data['response']['numFound'], 3)

        # Long params.
        resp_body = self.solr._select({'q': 'doc' * 1024})
        resp_data = json.loads(resp_body)
        self.assertEqual(resp_data['response']['numFound'], 0)
        self.assertEqual(len(resp_data['responseHeader']['params']['q']), 3 * 1024)

        # Test Deep Pagination CursorMark
        resp_body = self.solr._select({
            'q': '*',
            'cursorMark': '*',
            'sort': 'id desc',
            'start': 0,
            'rows': 2})
        resp_data = json.loads(resp_body)
        self.assertEqual(len(resp_data['response']['docs']), 2)
        self.assertIn('nextCursorMark', resp_data)
Exemplo n.º 2
0
 def json(self):
     return json.loads(self.content)
Exemplo n.º 3
0
 def test__suggest_terms(self):
     resp_body = self.solr._select({'terms.fl': 'title'})
     resp_data = json.loads(resp_body)
     self.assertEqual(resp_data['response']['numFound'], 0)
Exemplo n.º 4
0
 def test__mlt(self):
     resp_body = self.solr._mlt({'q': 'id:doc_1', 'mlt.fl': 'title'})
     resp_data = json.loads(resp_body)
     self.assertEqual(resp_data['response']['numFound'], 0)