marpaia / chef-golang

Go library to interact with the Chef server API
Other
77 stars 31 forks source link

Partial search support #10

Open josephholsten opened 10 years ago

josephholsten commented 10 years ago

Partial search is much faster than regular search, and only requires POSTing desired keys to the search query endpoint.

The official client implementation is defined here: partial_search:libraries/partial_search.rb:49

marpaia commented 10 years ago

pull requests welcome!

josephholsten commented 10 years ago

I'm working on it, I don't mean to be a leach user.

spheromak commented 10 years ago

fyi @josephholsten @marpaia #19 brings in the basic support in POST to support partial. I need to talk to @ctdk about the goiardi support for partial search. example partial in the test code for POST

Should be simple enough to add a nice 'PartialSearch' method to the search package.

ctdk commented 10 years ago

goiardi supports partial support just fine.

spheromak commented 10 years ago

@ctdk hrm them possibly i was doing it wrong in my test. I was following what documentation was on the website for the server api to partial search. I guess i should look at pedant. If yer around on irc tomorrow i will ping you.

ctdk commented 10 years ago

Yeah, last I checked anyway goiardi was passing the partial search tests in chef-pedant with flying colors. I'm running in-mem no-auth tests right now on the mysql branch (and will be testing the other modes as time permits today), so I'll see how those do with partial search too.

spheromak commented 10 years ago

@ctdk @marpaia @josephholsten #21 shows partial working in test.

josephholsten commented 10 years ago

I'll be needing partial search this week, I'm looking forward to it!

spheromak commented 10 years ago

@josephholsten cool the support is there in .Post, but not in the search package. Should be easy nuf to write some types and a wrapper in search if you want to take a crack at it. This is the dumped struct coming back off the unmarshal:


(map[string]interface {}) {
 (string) "rows": ([]interface {}) {
  (map[string]interface {}) {
   (string) "data": (map[string]interface {}) {
    (string) "name": (string) "neo4j.example.org"
   },
   (string) "url": (string) "http://localhost:8443/nodes/neo4j.example.org"
  }
 },
 (string) "start": (float64) 0,
 (string) "total": (float64) 1
}