Brian, First, our documentation is wrong. Sorry. The correct way to add aliases looks like so:
{field, [ {name, "Name"}, {analyzer_factory, {erlang, text_analyzers, standard_analyzer_factory}}, {alias, "LastName"}, {alias,"FirstName"}, {alias,"MiddleName"} ]}, Second, it looks like you want the semantics of a Solr copyField. That is, index the first, middle, and last names individually but also copy their contents into the field `Name` so that a user can easily search against the entire name. Unfortunately Riak Search's alias mechanism doesn't provide this semantic even if the documentation might give that impression. An alias does 2 things: 1. If a field exist with the same name as the alias then index it under the containing field name. E.g. if the field 'LastName' exists then index it under 'Name'. Riak Search only indexes a field once. So either the alias 'FirstName' is found and indexed under 'Name' or 'FirstName' is found and indexed under 'FirstName'. This means that if you declare both an alias and a normal field with the same name the order in the schema will determine which one wins. Both will not be used. 2. If there are multiple alises for a given field then concatenate the values of every alias to form one field value. The order they are concatenated is the same order as they are declared in the object being indexed. Thus if you happened to index {M:Middle, F:Firrst, L:Last} then the 'Name' field would have value 'Middle First Last'. To achieve your goal you need to copy the field yourself. Declare the 'Name' field like the other fields. Don't use aliases. Index the object as {"FirstName":"First", "MiddleName":"Middle", "LastName":"Last", "Name":"First Middle Last"}. -Z P.S. The new search solution I've been working on, Yokozuna, integrates Solr with Riak and thus supports copy fields. http://lists.basho.com/pipermail/riak-users_lists.basho.com/2012-November/010042.html On Sun, Oct 28, 2012 at 4:54 PM, Brian Hodgen <brian.hod...@gmail.com>wrote: > Can somebody explain in more detail how the aliases parameter on the > search schema definition works? The documentation says it lets me > index multiple fields into one, so I tried to setup some schemas to let me > search on Name, that is actually the combined data of FirstName, LastName, > & MiddleName. I've got the search working for the properties by themselves, > but I can't seem to make the aliases work, so I'm either doing something > wrong or I misunderstood how they are supposed to work. > > > Schema Example: > > I would really like this to work...but querying on Name never returns any > results. > > { > schema, > [ > {version, "1.1"}, > {n_val, 3}, > {default_field, "Name"}, > {analyzer_factory, {erlang, text_analyzers, noop_analyzer_factory}} > ], > [ > {field, [ > {name, "FirstName"}, > {analyzer_factory, {erlang, text_analyzers, standard_analyzer_factory}} > ]}, > {field, [ > {name, "MiddleName"}, > {analyzer_factory, {erlang, text_analyzers, > standard_analyzer_factory}} > ]}, > {field, [ > {name, "LastName"}, > {analyzer_factory, {erlang, text_analyzers, standard_analyzer_factory}} > ]}, > {field, [ > {name, "Name"}, > {analyzer_factory, {erlang, text_analyzers, > standard_analyzer_factory}}, > {aliases, ["LastName","FirstName","MiddleName"]} > ]}, > {dynamic_field, [ > {name, "*"}, > {skip, true} > ]} > ] > }. > > > _______________________________________________ > riak-users mailing list > riak-users@lists.basho.com > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com > >
_______________________________________________ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com