Go client for Manticore Search
First we make sure there's a running Manticore instance on the machine
Now we can instal Go-SDK with the following command:
go get github.com/manticoresoftware/go-sdk/manticore
Lets' take a look at this simple Go script:
The script creates a new Manticore client, executes simple INSERT requests to the testrt index and then makes a query for the added content.
Let's run it:
go run manticore.go
As we see, new docs were succesfully added to the index and two docs containing more or another words were found by the query.
A couple more examples
With Go-SDK you can easily filter your query results by index attributes
This script creates a new Manticore client, executes simple INSERT requests to the testrt index and then makes two queries searching for content word. The first query retrieves all docs as all docs in the index now contain this word. The second query uses the filter we've created and retrieves only the docs that contain content word and have attribute gid equal to 10. In our case, there's only one doc under these conditions, with id=10
go run manticore2.go
You can also use an SQL-like expression to do your filtering.
Here we use 'gid > 10 AND gid < 20' expression to filter our query result. Like in the previous example the first query retrieves all the docs from the index and the second one retrieves only the docs with gid=15
go run manticore3.go