Coder Social home page Coder Social logo

go-sdk's Introduction

Official Go client for Manticore Search.

Compatibility

The client is compatible with Manticore Search 2.8.2 and higher for majority of the commands. It also may be used in many cases to access SphinxSearch daemon as well. However it's not guaranteed.

Requirements

Go version 1.9 or higher

Installation

go get github.com/manticoresoftware/go-sdk/manticore

Usage

Here's a short example on how the client can be used: Make sure there's some running Manticore instance, you can use our docker image for a quick test:

docker run --name manticore -p 9313:9312 -p9306:9306 -d manticoresearch/manticore

Here's just a simplest script:

[root@srv ~]# cat manticore.go
package main

import "github.com/manticoresoftware/go-sdk/manticore"
import "fmt"

func main() {
	cl := manticore.NewClient()
	cl.SetServer("127.0.0.1", 9313)
	cl.Open()
	res, err := cl.Sphinxql(`replace into testrt values(1,'my subject', 'my content', 15)`)
	fmt.Println(res, err)
	res, err = cl.Sphinxql(`replace into testrt values(2,'another subject', 'more content', 15)`)
	fmt.Println(res, err)
	res, err = cl.Sphinxql(`replace into testrt values(5,'again subject', 'one more content', 10)`)
	fmt.Println(res, err)
	res2, err2 := cl.Query("more|another", "testrt")
	fmt.Println(res2, err2)
}

And here's how it works:

[root@srv ~]# go run manticore.go
[Query OK, 1 rows affected] <nil>
[Query OK, 1 rows affected] <nil>
[Query OK, 1 rows affected] <nil>
Status: ok
Query time: 0s
Total: 1
Total found: 1
Schema:
	Fields:
		title
		content
	Attributes:
		gid: int
Matches:
	Doc: 2, Weight: 2, attrs: [15]
Word stats:
	'more' (Docs:2, Hits:2)
	'another' (Docs:1, Hits:1)
 <nil>

Read full documentation on godoc to learn more about available functions and find more examples. You can also read it from the console as go doc go-sdk/manticore

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.