All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.basho.riak.client.api.commands.search.StoreIndex Maven / Gradle / Ivy

There is a newer version: 2.1.1
Show newest version
package com.basho.riak.client.api.commands.search;

import com.basho.riak.client.api.RiakCommand;
import com.basho.riak.client.api.commands.CoreFutureAdapter;
import com.basho.riak.client.core.RiakCluster;
import com.basho.riak.client.core.RiakFuture;
import com.basho.riak.client.core.operations.YzPutIndexOperation;
import com.basho.riak.client.core.query.search.YokozunaIndex;


/**
 * Command used to store a search index in Riak.
 * 

* To store/create an index for Solr/Yokozuna in Riak, you must supply a * {@link com.basho.riak.client.core.query.search.YokozunaIndex} that defines the index and it's properties. *

* * @author Dave Rusek * @since 2.0 */ public final class StoreIndex extends RiakCommand { private final YokozunaIndex index; StoreIndex(Builder builder) { this.index = builder.index; } @Override protected RiakFuture executeAsync(RiakCluster cluster) { RiakFuture coreFuture = cluster.execute(buildCoreOperation()); CoreFutureAdapter future = new CoreFutureAdapter(coreFuture) { @Override protected Void convertResponse(Void coreResponse) { return coreResponse; } @Override protected YokozunaIndex convertQueryInfo(YokozunaIndex coreQueryInfo) { return coreQueryInfo; } }; coreFuture.addListener(future); return future; } private final YzPutIndexOperation buildCoreOperation() { return new YzPutIndexOperation.Builder(index).build(); } /** * Builder for a StoreIndex command. */ public static class Builder { private final YokozunaIndex index; /** * Construct a Builder for a StoreIndex command. * * @param index The index to create or edit in Riak. */ public Builder(YokozunaIndex index) { this.index = index; } /** * Construct the StoreIndex command. * @return the new StoreIndex command. */ public StoreIndex build() { return new StoreIndex(this); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy