Сlient for Manticore Search.
❗ WARNING: this is a development version of the client. The latest release's readme is https://github.com/manticoresoftware/manticoresearch-go/tree/v1.9.0
manticoresearch-go Manticore Search Go Compatibilitydev
dev
(latest development version) 1.17.0 or newer ✅ Fully Compatible v1.6.0 or newer 7.0.0 or newer 1.17.0 or newer ✅ Fully Compatible v1.6.0 or newer 6.2.12 to 7.0.0 1.17.0 or newer ⚠️ Partially Compatible v1.0.0 to v1.6.0 6.3.6 to 7.0.0 1.17.0 or newer ✅ Fully Compatible v1.0.0 to v1.6.0 6.2.12 to 6.3.6 1.17.0 or newer ⚠️ Partially Compatible
go get github.com/manticoresoftware/manticoresearch-go@dev
go mod init main go get github.com/manticoresoftware/manticoresearch-go@dev
package main import ( "context" "fmt" Manticoresearch "github.com/manticoresoftware/manticoresearch-go" ) func main() { // Create an instance of API client configuration := Manticoresearch.NewConfiguration() configuration.Servers[0].URL = "http://localhost:9308" apiClient := Manticoresearch.NewAPIClient(configuration) // Perform insert and search operations tableName := "products" indexDoc := map[string]interface{} {"title": "Crossbody Bag with Tassel"} indexReq := Manticoresearch.NewInsertDocumentRequest(tableName, indexDoc) indexReq.SetId(1) apiClient.IndexAPI.Insert(context.Background()).InsertDocumentRequest(*indexReq).Execute(); searchRequest := Manticoresearch.NewSearchRequest(tableName) searchQuery := Manticoresearch.NewSearchQuery() searchQuery.QueryString = "@title Bag" searchRequest.Query = searchQuery queryHighlight := Manticoresearch.NewHighlight() queryHighlight.Fields = map[string]interface{} {"title": map[string]interface{} {}} searchRequest.Highlight = queryHighlight _, httpRes, _ := apiClient.SearchAPI.Search(context.Background()).SearchRequest(*searchRequest).Execute() fmt.Printf("%+v\n\n", httpRes) }Configuration of Server URL
Default configuration comes with Servers
field that contains server objects as defined in the OpenAPI specification.
For using other server than the one defined on index 0 set context value openapi.ContextServerIndex
of type int
.
ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1)
Templated server URL is formatted using default variables from configuration or from context value openapi.ContextServerVariables
of type map[string]string
.
ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{ "basePath": "v2", })
Note, enum values are always validated and all unused variables are silently ignored.
To use a proxy, set the environment variable HTTP_PROXY
:
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
More details on the use of HTTP_PROXY
can be found here
All URIs are relative to http://127.0.0.1:9308
Class Method HTTP request Description IndexAPI Bulk Post /bulk Bulk table operations IndexAPI Delete Post /delete Delete a document in a table IndexAPI Insert Post /insert Create a new document in a table IndexAPI PartialReplace Post /{table}/_update/{id} Partially replaces a document in a table IndexAPI Replace Post /replace Replace new document in a table IndexAPI Update Post /update Update a document in a table SearchAPI Autocomplete Post /autocomplete Performs an autocomplete search on a table SearchAPI Percolate Post /pq/{table}/search Perform reverse search on a percolate table SearchAPI Search Post /search Performs a search on a table UtilsAPI Sql Post /sql Perform SQL requestsEndpoints do not require authorization.
Documentation for Utility MethodsDue to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:
PtrBool
PtrInt
PtrInt32
PtrInt64
PtrFloat
PtrFloat32
PtrFloat64
PtrString
PtrTime
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4