Skip to content

Instantly share code, notes, and snippets.

@igorgue
Created December 20, 2012 23:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igorgue/4349616 to your computer and use it in GitHub Desktop.
Save igorgue/4349616 to your computer and use it in GitHub Desktop.
Riak search schema for my bucket, it's the default and I always store JSON data.
%% Schema for 'objects'
{
schema,
[
{version, "1.1"},
{n_val, 3},
{default_field, "value"},
{analyzer_factory, {erlang, text_analyzers, whitespace_analyzer_factory}}
],
[
%% Field names ending in "_num" are indexed as integers
{dynamic_field, [
{name, "*_num"},
{type, integer},
{analyzer_factory, {erlang, text_analyzers, integer_analyzer_factory}}
]},
%% Field names ending in "_int" are indexed as integers
{dynamic_field, [
{name, "*_int"},
{type, integer},
{analyzer_factory, {erlang, text_analyzers, integer_analyzer_factory}}
]},
%% Field names ending in "_dt" are indexed as dates
{dynamic_field, [
{name, "*_dt"},
{type, date},
{analyzer_factory, {erlang, text_analyzers, noop_analyzer_factory}}
]},
%% Field names ending in "_date" are indexed as dates
{dynamic_field, [
{name, "*_date"},
{type, date},
{analyzer_factory, {erlang, text_analyzers, noop_analyzer_factory}}
]},
%% Field names ending in "_txt" are indexed as full text"
{dynamic_field, [
{name, "*_txt"},
{type, string},
{analyzer_factory, {erlang, text_analyzers, standard_analyzer_factory}}
]},
%% Field names ending in "_text" are indexed as full text"
{dynamic_field, [
{name, "*_text"},
{type, string},
{analyzer_factory, {erlang, text_analyzers, standard_analyzer_factory}}
]},
%% Everything else is a string
{dynamic_field, [
{name, "*"},
{type, string},
{analyzer_factory, {erlang, text_analyzers, whitespace_analyzer_factory}}
]}
]
}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment