
com.basho.riak.client.api.commands.StoreSearchIndex Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of riak-client Show documentation
Show all versions of riak-client Show documentation
HttpClient-based client for Riak
package com.basho.riak.client.api.commands;
import com.basho.riak.client.api.RiakCommand;
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;
import java.util.concurrent.ExecutionException;
/*
* @author Dave Rusek
* @since 2.0
*/
public final class StoreSearchIndex extends RiakCommand
{
private final YokozunaIndex index;
StoreSearchIndex(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();
}
public static class Builder
{
private final YokozunaIndex index;
public Builder(YokozunaIndex index)
{
this.index = index;
}
public StoreSearchIndex build()
{
return new StoreSearchIndex(this);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy