O'Reilly logo

Distributed Computing with Go by V.N. Nikhil Anurag

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Testing feeder.go using /api/index

Here's the feeder.go script to check if /api/index accepts index terms:

package main import ( "bytes" "encoding/json" "io/ioutil" "log" "net/http" ) type tPayload struct { Token string 'json:"token"' Title string 'json:"title"' DocID string 'json:"doc_id"' LIndex int 'json:"line_index"' Index int 'json:"token_index"' } type msgS struct { Code int 'json:"code"' Msg string 'json:"msg"' } func main() { // Searching for "apple" should return Book 1 at the top of search results. // Searching for "cake" should return Book 3 at the top. for bookX, terms := range map[string][]string{ "Book 1": []string{"apple", "apple", "cat", "zebra"}, "Book 2": []string{"banana", "cake", "zebra"}, "Book 3": []string{"apple", "cake", ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required