Exemplo n.º 1
0
func (s *PostingSuite) TestTemporarySearch(c *C) {
	go Serve(s.Registry)
	client, err := NewClient(s.Registry)
	client.Initialise()
	ids := buildDocuments(s, c)
	for _, id := range ids {
		err = client.CallMultiple("Posting.Add", &document.DocumentArg{Id: id})
		c.Assert(err, IsNil)
	}
	tempSearch := &document.DocumentArg{Text: document.RandomWords(10000)}
	_, err = client.Search(tempSearch)
	// c.Check(len(results.), Equals, 0)
	c.Assert(err, IsNil)
}
Exemplo n.º 2
0
func (s *PostingSuite) TestSimpleAddDocument(c *C) {
	text := document.RandomWords(120)
	p := newPosting(s.Registry, "test")
	p.Init(&s.Registry.PostingConfigs[0], nil)
	doc1, _ := document.BuildDocument(1, 2, "Document 1", text, nil)
	err := doc1.Save(s.Registry)
	c.Assert(err, IsNil)
	err = p.Add(&document.DocumentArg{Id: &doc1.Id}, nil)
	c.Assert(err, IsNil)
	doc2, _ := document.BuildDocument(1, 7, "Document 2", text, nil)
	err = doc2.Save(s.Registry)
	c.Assert(err, IsNil)
	err = p.Add(&document.DocumentArg{Id: &doc2.Id}, nil)
	c.Assert(err, IsNil)
}