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

com.algolia.search.models.indexing.QuerySerializer Maven / Gradle / Ivy

There is a newer version: 3.16.9
Show newest version
package com.algolia.search.models.indexing;

import com.algolia.search.util.QueryStringUtils;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import java.io.IOException;

/** Customer serializer to serialize an Algolia search query as URL parameters */
public class QuerySerializer extends StdSerializer {

  public QuerySerializer() {
    this(null);
  }

  private QuerySerializer(Class t) {
    super(t);
  }

  @Override
  public void serialize(Query value, JsonGenerator gen, SerializerProvider provider)
      throws IOException {
    gen.writeString(QueryStringUtils.buildQueryAsQueryParams(value));
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy