Beispiel #1
0
    def test_consistency(self):
        uuid = str('10000')
        vb = 42
        seq = 101
        ixname = 'ix'

        mutinfo = (vb, uuid, seq, 'dummy-bucket-name')
        ms = MutationState()
        ms._add_scanvec(mutinfo)

        params = search.SearchOptions(consistent_with=ms)
        got = params._gen_search_params('ix', search.MatchNoneQuery()).body
        exp = {
            'indexName': ixname,
            'query': {
                'match_none': None
            },
            'ctl': {
                'consistency': {
                    'level': 'at_plus',
                    'vectors': {
                        ixname: {
                            '{0}/{1}'.format(vb, uuid): seq
                        }
                    }
                }
            }
        }
        self.assertEqual(exp, got)
Beispiel #2
0
 def test_match_all_none_queries(self):
     self.assertEqual({'match_all': None}, search.MatchAllQuery().encodable)
     self.assertEqual({'match_none': None},
                      search.MatchNoneQuery().encodable)