Permalink
Browse files

Initial implementation. Only Status API call supported

  • Loading branch information...
0 parents commit d61ecbfa6145ee7c653e8e6ea37944a5056fa017 @kpumuk committed Jan 18, 2010
Showing with 418 additions and 0 deletions.
  1. +4 −0 .gitignore
  2. +14 −0 Makefile
  3. +18 −0 README.markdown
  4. +21 −0 main.go
  5. +361 −0 sphinx.go
@@ -0,0 +1,4 @@
+*~
+*.[68]
+_obj
+main
@@ -0,0 +1,14 @@
+include $(GOROOT)/src/Make.$(GOARCH)
+
+TARG=net/sphinx
+GOFILES=sphinx.go
+
+include $(GOROOT)/src/Make.pkg
+
+main: package
+ $(GC) -I_obj main.go
+ $(LD) -L_obj -o $@ main.$O
+
+format:
+ gofmt -spaces=true -tabindent=false -tabwidth=4 -w sphinx.go
+ gofmt -spaces=true -tabindent=false -tabwidth=4 -w test.go
@@ -0,0 +1,18 @@
+# gosphinx
+
+[Go][Go] Clients and Connectors for [Sphinx][Sphinx].
+
+# Getting started:
+
+To build and install gosphinx, from the root directory of the git clone:
+
+ make install
+
+## examples
+
+After installing gosphinx (per above), try (again from the root dir of gosphinx):
+
+ make main && ./main
+
+[Go]: http://golang.org/
+[Sphinx]: http://sphinxsearch.com/
21 main.go
@@ -0,0 +1,21 @@
+package main
+
+import (
+ "net/sphinx"
+ "fmt"
+)
+
+func main() {
+ sphinx := sphinx.NewClient()
+ sphinx.SetServer("127.0.0.1", 3312)
+
+ fmt.Println("Retrieving Sphinx status")
+ status, err := sphinx.Status()
+ if err != nil {
+ fmt.Println("Error: ", err)
+ } else {
+ for i := 0; i < len(status); i++ {
+ fmt.Printf("%20s %s\n", status[i][0] + ":", status[i][1])
+ }
+ }
+}
Oops, something went wrong.

0 comments on commit d61ecbf

Please sign in to comment.