Skip to content
This repository was archived by the owner on Aug 13, 2026. It is now read-only.
This repository was archived by the owner on Aug 13, 2026. It is now read-only.

Annotation-based 2i with dynamic index names [JIRA: CLIENTS-1017] #679

Description

@runesl

The current RiakIndex annotation requires the name to be static like "email" here:

@RiakIndex(name="email")
public Set<String> emailIndx;

We need a way to annotate dynamic indices like:

@RiakIndex
public Map<String, String> references;

Where each key in the Map is a 2i key to index, and each value is the corresponding 2i value.

The old RiakObject based API can do this.
Is this something basho can implement or would you be willing to merge a PR on it?

Activity

  1. changed the title [-]Annotation-based 2i with dynamic index names[/-] [+]Annotation-based 2i with dynamic index names [JIRA: CLIENTS-1017][/+] on Oct 21, 2016
  2. alexmoore commented on Oct 21, 2016

    @alexmoore
    Contributor

    Hi Rune,

    PR's are very welcome! This seems like a small design regression from when we rebuilt the client, so I'd be happy to review and merge anything provided.

    Thanks,
    Alex

  3. alexmoore commented on Nov 16, 2016

    @alexmoore
    Contributor

    Looks like for this one we'd need to add the appropriate type sniffing code in RiakIndexField and RiakIndexMethod, to detect a map of the proper key type.

  4. alexmoore commented on Nov 16, 2016

    @alexmoore
    Contributor

    Also, I can't find any examples in the 1.4 Client where you can assign the RiakIndex annotation to a Map, do you have any examples you can share / link to?

  5. runesl commented on Dec 12, 2016

    @runesl
    Author

    In http, you can add the same index multiple times when storing.

    curl 192.168.99.100:8098/buckets/test/keys/a -XPUT -d 'hello' -H 'X-Riak-Index-myIndex_bin: myvalue1' -H 'X-Riak-Index-myIndex_bin: myvalue2' 
    curl 192.168.99.100:8098/buckets/test/index/myIndex_bin/myvalue1
    {"keys":["a"]}
    curl 192.168.99.100:8098/buckets/test/index/myIndex_bin/myvalue2
    {"keys":["a"]}
    

    I'm pretty sure, you can do the same in the old java api.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions