README.markdown

## Description
giza is a client library for the Sphinx search engine (http://www.sphinxsearch.com). It speaks Sphinx's
binary searchd protocol natively.  This fork is meant to update the library to the point where it can
be used with modern Sphinx and be included as a dependency in elixir.  I am doing testing from the
Phoenix Framework http://www.phoenixframework.org/

giza currently supports the following features:

- Full text (Unicode) searching
- Attribute filters (numeric values only)
- Index updates
- Pagination via query limit and offset
- Document id ranges via min_id and max_id
- Updating document attributes

To Do:

- Excerpt support
- Support for more query fields
- Fix string support (added, but sphinx tcp response seems to be returning all as length 0)
- Add JSON support
- Add sphinx 2.3.x support including suggestion lib and possibly REST support
- Update tests so they work in modern erlang and elixir (disabled current tests in Makefile)
- Generic Sphinx test harness


## Examples

1. Performing a simple search:
<pre>
    Query = giza_query:new("users", "frederickson"),
    Results = giza_request:send(Query)
</pre>
2. Performing a paginated search:
<pre>
    Q = giza_query:new("users", "frederickson"),
    Q1 = giza_query:offset(Q, 10),
    Results = giza_request:send(Q1)
</pre>
3. Querying a non-default host:
<pre>
    Q = giza_query:new("users", "frederickson"),
    Q1 = giza_query:host(Q, "search.somewhere"),
    Results = giza_request:send(Q1)
</pre>
4. Using giza's attribute filtering:
<pre>
    Q = giza_query:new("users", "frederickson"),
    %% This is an inclusionary filter by default
    Q1 = giza_query:add_filter(Q, "user_type", [1,3,5]),
    Results = giza_request:send(Q1)
</pre>
<pre>
    Q = giza_query:new("users", "frederickson"),
    %% Filter with explicit exclude info (exclude == true)
    Q1 = giza_query:add_filter(Q, "user_type", true, [1,3,5]),
    Results = giza_request:send(Q1)
</pre>
5. Updating a Sphinx index using giza:
<pre>
  U = giza_update:new("users"),
  U1 = giza_update:add_attribute(U, "user_type"),
  U2 = giza_update:add_doc(U1, 12345, [1]),
  %% Returns number of docs updated
  giza_request:send(U2),
</pre>