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

com.basho.riak.client.api.commands.mapreduce.SearchInputSerializer Maven / Gradle / Ivy

The newest version!
package com.basho.riak.client.api.commands.mapreduce;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

import java.io.IOException;

/**
 * Serializes a {@link SearchInput} to a Riak MapReduce JSON format.
 */
public class SearchInputSerializer extends JsonSerializer
{
    @Override
    public void serialize(SearchInput input, JsonGenerator jg, SerializerProvider sp) throws IOException
    {
        jg.writeStartObject();
        jg.writeObjectField("module", "yokozuna");
        jg.writeObjectField("function", "mapred_search");

        jg.writeArrayFieldStart("arg");
        jg.writeString(input.getIndex());
        jg.writeString(input.getSearch());
        jg.writeEndArray();
        jg.writeEndObject();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy