Skip to content

Instantly share code, notes, and snippets.

@rawsyntax
Created October 17, 2013 16:02
Show Gist options
  • Select an option

  • Save rawsyntax/7027571 to your computer and use it in GitHub Desktop.

Select an option

Save rawsyntax/7027571 to your computer and use it in GitHub Desktop.
schema file
%% Schema for 'search'
{
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