Skip to content

Results format and structure

floere edited this page Oct 19, 2010 · 30 revisions

The Picky Results

Example

It’s a library search. You search for “Pinchn~”, and Picky has a result with Pynchon in the title.

You get back a JSON formatted string from Picky:

{"offset":0,"total":1,"duration":0.022148,"allocations":[["books",6.0,1,[["title","Pinchn~","pynchon"]],[27]]]}

The format

JSON.

The structure

Picky gives you a hash:
{
offset: The results have this offset. An offset of 10 will omit the first 10 ids and give you ids from the 11th position and up.
total: The total amount of results found, covering all allocations.
duration: How long it took Picky to find the results. Rack time, transfer time, and HTTP header adding not included. Just the time it took Picky itself to find the result.
allocations: An array of possible allocations of search terms to categories (see below). Using the example above we get:
[
“books”, # The index name.
6.0, # The weight of the result. Allocations are ordered by their weights.
[
“title”, # Name of the category of the following search terms.
“Pinchn~”, # The original search term (upper case and all).
“pynchon” # The search term as picky interpreted it.
],
… # More search terms in this allocation.
],
… # More allocations, ordered by weight, descending.
]
}

That’s it simple and easy.

What is an allocation?