That makes sense. Thanks!
On Jan 29, 2011 11:59 AM, "Gordon Tillman" <[email protected]> wrote:
> Hi Eric,
>
> Yes you can do this, but you need to "encode" your information
appropriately. Using the example that you provided, you would store your
JSON object as follows:
>
> {
> "title": "Hello, World!"
> "tags": "greetings first%20program"
> }
>
> Make sure that the search schema for your bucket is indexing your tags
field using whitespace_analyzer_factory (I think that is the new default
anyway).
>
> The key here is that you quote the tags before storing your object and
unquote the tags after retrieving your object. If you create models that
represent the things that you store in Riak then you automate that process
pretty easily.
>
> You will still store tags in a list (or better yet, a set) in your model,
but you will quote each one and save it as a whitespace-delimited string
before storing in Riak. When you read it in from Riak you can split and
unquote to restore to a list or set in your model.
>
> By using whitespace_analyzer_factory for the tags field (instead of say
the standard_analyzer_factory) the code that parses that field for indexing
will do the right thing.
>
>
> Be sure and read the notes about escaping special characters in search
terms here:
>
> http://lucene.apache.org/java/2_4_0/queryparsersyntax.html#EscapingSpecial 
> Characters<
http://lucene.apache.org/java/2_4_0/queryparsersyntax.html#Escaping%20Special%20Characters
>
>
>
> --gordon
>
> On Jan 28, 2011, at 19:14, Eric Moritz wrote:
>
> Is there a way to index tags in Riak Search? For example, say I have the
following data structure:
>
> hello.json
>
> {
> "title": "Hello, World!"
> "tags": ["greetings", "first program"]
> }
>
> I noticed the result from Solr returns fielded data that resembles this:
>
> GET /solr/tagtest/select?q=tags:greetings&wt=json
>
> {
> "title": "Hello, World",
> "tags": "greetings first programs
> }
>
> Now if I use "q=tags:program", the same document is returned. Is there an
analyzer that will treat each item in that list as a single term?
>
> Thanks,
> Eric.
>
> <ATT00001..txt>
>
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to