Autocomplete is an http server that manages recency based lists of keywords. Keywords are normalized according to user supplied locale and are searchable by prefix. For unique tests, keys may be accompanied by a user supplied id. This id is also searchable. An arbitrary data section is also provided.
- [http://libevent.org/](libevent 2.x)
- https://github.com/json-c/json-c.git
- http://site.icu-project.org/download
N.B. compile libicu with utf-8 define
make && make install
./autocomplete -d /var/autocomplete
###GET /put
namespace
(req) - high level aggregation, typically user
key
(req) - key for future searches
locale
(opt) - locale used to normalize key ( see libicu )
id
(opt) - secondary element for uniq
data
(opt) - opaque data element returned on search
ts
(opt) - utc timestamp of last used
Either creates a new element or updates an existing elements position in the recency list. The namespace is also marked dirty for subsequent flushing to disk.
Initial access of namespace can force a read from disk.
200 OK
500 INTERNAL
400 BAD_REQUEST
###GET /del
namespace
(req) - high level aggregation, typically user
key
(req) - key for future searches
locale
(opt) - locale used to normalize key ( see libicu )
id
(opt) - secondary element for uniq
Deletes an element identified by key and id. The namespace is marked dirty for subsequent flushing to disk.
200 OK
400 BAD_REQUEST
###GET /nuke
namespace
(req) - high level aggregation, typically user
key
(opt) - key prefix, if not present nuke all
locale
(opt) - locale used to normalize key ( see libicu )
Deletes elements matching key prefix. The namespace is marked dirty for subsequent flushing to disk.
200 OK 400 BAD_REQUEST
###GET /search
namespace
(req) - high level aggregation, typically user
key
(opt) - key prefix match, if not passed matches all
locale
(opt) - locale used to normalize key ( see libicu )
id
(opt) - secondary element for uniq
limit
(opt:1,000) - max records to return
Initial access of namespace can force a read from disk.
200 OK
{ "results": [ { "key": "twit", "id": "123", "when": 1352840225, "count": 40, "data": "twenty" } ] }
400 BAD_REQUEST