Merge pull request #6 from r--w/master

Extra parameters for searching
This commit is contained in:
Jérôme Renard 2014-05-08 20:33:45 +02:00
commit a3660786e2
2 changed files with 6 additions and 5 deletions

View File

@ -165,7 +165,7 @@ func (c *Connection) BulkSend(index string, documents []Document) (Response, err
}
// Search executes a search query against an index
func (c *Connection) Search(query map[string]interface{}, indexList []string, typeList []string) (Response, error) {
func (c *Connection) Search(query map[string]interface{}, indexList []string, typeList []string, extraArgs url.Values) (Response, error) {
r := Request{
Conn: c,
Query: query,
@ -173,6 +173,7 @@ func (c *Connection) Search(query map[string]interface{}, indexList []string, ty
TypeList: typeList,
method: "POST",
api: "_search",
ExtraArgs: extraArgs,
}
return r.Run()

View File

@ -224,7 +224,7 @@ func (s *GoesTestSuite) TestBulkSend(c *C) {
},
}
searchResults, err := conn.Search(query, []string{indexName}, []string{})
searchResults, err := conn.Search(query, []string{indexName}, []string{}, url.Values{})
c.Assert(err, IsNil)
var expectedTotal uint64 = 2
@ -275,7 +275,7 @@ func (s *GoesTestSuite) TestBulkSend(c *C) {
_, err = conn.RefreshIndex(indexName)
c.Assert(err, IsNil)
searchResults, err = conn.Search(query, []string{indexName}, []string{})
searchResults, err = conn.Search(query, []string{indexName}, []string{}, url.Values{})
c.Assert(err, IsNil)
expectedTotal = 0
@ -525,7 +525,7 @@ func (s *GoesTestSuite) TestSearch(c *C) {
},
},
}
response, err := conn.Search(query, []string{indexName}, []string{docType})
response, err := conn.Search(query, []string{indexName}, []string{docType}, url.Values{})
expectedHits := Hits{
Total: 1,
@ -793,7 +793,7 @@ func (s *GoesTestSuite) TestAggregations(c *C) {
},
}
resp, err := conn.Search(query, []string{indexName}, []string{docType})
resp, err := conn.Search(query, []string{indexName}, []string{docType}, url.Values{})
user, ok := resp.Aggregations["user"]
c.Assert(ok, Equals, true)