Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
runesl opened this issue Oct 21, 2016 · 4 comments
Open

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

runesl opened this issue Oct 21, 2016 · 4 comments

Comments

@runesl
Copy link

runesl commented Oct 21, 2016

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?

@Basho-JIRA Basho-JIRA changed the title Annotation-based 2i with dynamic index names Annotation-based 2i with dynamic index names [JIRA: CLIENTS-1017] Oct 21, 2016
@alexmoore
Copy link
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

@alexmoore
Copy link
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.

@alexmoore
Copy link
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?

@runesl
Copy link
Author

runesl commented Dec 12, 2016

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
Projects
None yet
Development

No branches or pull requests

3 participants