Skip to content

kevsmith/giza

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Description

giza is a client library for the Sphinx search engine (http://www.sphinxsearch.com). It speaks Sphinx's binary searchd protocol natively.

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
  • Generic Sphinx test harness

Patches are always welcome ;-)

Examples

  1. Performing a simple search:
    Query = giza_query:new("users", "frederickson"),
    Results = giza_request:send(Query)
  1. Performing a paginated search:
    Q = giza_query:new("users", "frederickson"),
    Q1 = giza_query:offset(Q, 10),
    Results = giza_request:send(Q1)
  1. Querying a non-default host:
    Q = giza_query:new("users", "frederickson"),
    Q1 = giza_query:host(Q, "search.somewhere"),
    Results = giza_request:send(Q1)
  1. Using giza's attribute filtering:
    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)
    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)
  1. Updating a Sphinx index using giza:
  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),

Thanks to Nick Gerakines and the folks at EA for supporting giza!

About

Erlang client for the Sphinx search engine

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published