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

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

The newest version!
package com.algolia.search.models.indexing;

import com.algolia.search.models.rules.RenderingContent;
import com.algolia.search.util.AlgoliaUtils;
import com.fasterxml.jackson.annotation.JsonSetter;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.stream.IntStream;
import javax.annotation.Nonnull;

@SuppressWarnings({"unused", "WeakerAccess"})
public class SearchResult implements Serializable {

  private Long page;
  private Long nbHits;
  private Long nbPages;
  private Long hitsPerPage;
  private Long processingTimeMS;
  private Map> facets;
  private Map facets_stats;
  private Boolean exhaustiveFacetsCount;
  private String query;
  private String params;
  private List hits;
  private String index;
  private Boolean processed;
  private String queryID;
  private Explain explain;
  private List> userData;
  private List> appliedRules;
  private Boolean exhaustiveNbHits;
  private Integer appliedRelevancyStrictness;
  private Integer nbSortedHits;
  private RenderingContent renderingContent;
  private Integer abTestID;

  public Explain getExplain() {
    return explain;
  }

  public SearchResult setExplain(Explain explain) {
    this.explain = explain;
    return this;
  }

  public Long getOffset() {
    return offset;
  }

  public SearchResult setOffset(Long offset) {
    this.offset = offset;
    return this;
  }

  public Long getLength() {
    return length;
  }

  public SearchResult setLength(Long length) {
    this.length = length;
    return this;
  }

  public String getParsedQuery() {
    return parsedQuery;
  }

  public SearchResult setParsedQuery(String parsedQuery) {
    this.parsedQuery = parsedQuery;
    return this;
  }

  public Long getAbTestVariantID() {
    return abTestVariantID;
  }

  public SearchResult setAbTestVariantID(Long abTestVariantID) {
    this.abTestVariantID = abTestVariantID;
    return this;
  }

  public String getIndexUsed() {
    return indexUsed;
  }

  public SearchResult setIndexUsed(String indexUsed) {
    this.indexUsed = indexUsed;
    return this;
  }

  public String getServerUsed() {
    return serverUsed;
  }

  public SearchResult setServerUsed(String serverUsed) {
    this.serverUsed = serverUsed;
    return this;
  }

  public String getAutomaticRadius() {
    return automaticRadius;
  }

  public SearchResult setAutomaticRadius(String automaticRadius) {
    this.automaticRadius = automaticRadius;
    return this;
  }

  public String getAroundLatLng() {
    return aroundLatLng;
  }

  public SearchResult setAroundLatLng(String aroundLatLng) {
    this.aroundLatLng = aroundLatLng;
    return this;
  }

  public String getMessage() {
    return message;
  }

  public SearchResult setMessage(String message) {
    this.message = message;
    return this;
  }

  public String getQueryAfterRemoval() {
    return queryAfterRemoval;
  }

  public SearchResult setQueryAfterRemoval(String queryAfterRemoval) {
    this.queryAfterRemoval = queryAfterRemoval;
    return this;
  }

  public RenderingContent getRenderingContent() {
    return renderingContent;
  }

  public SearchResult setRenderingContent(RenderingContent renderingContent) {
    this.renderingContent = renderingContent;
    return this;
  }

  public Integer getAbTestID() {
    return abTestID;
  }

  public SearchResult setAbTestID(Integer abTestID) {
    this.abTestID = abTestID;
    return this;
  }

  private Long offset;
  private Long length;
  private String parsedQuery;
  private Long abTestVariantID;
  private String indexUsed;
  private String serverUsed;
  private String automaticRadius;
  private String aroundLatLng;
  private String message;
  private String queryAfterRemoval;

  public List> getAppliedRules() {
    return appliedRules;
  }

  public void setAppliedRules(List> appliedRules) {
    this.appliedRules = appliedRules;
  }

  public List> getUserData() {
    return userData;
  }

  public void setUserData(List> userData) {
    this.userData = userData;
  }

  public List getHits() {
    return hits;
  }

  public SearchResult setHits(List hits) {
    this.hits = hits;
    return this;
  }

  public Long getPage() {
    return page;
  }

  public SearchResult setPage(Integer page) {
    return this.setPage(page.longValue());
  }

  @JsonSetter
  public SearchResult setPage(Long page) {
    this.page = page;
    return this;
  }

  public Long getNbHits() {
    return nbHits;
  }

  public SearchResult setNbHits(Integer nbHits) {
    return this.setNbHits(nbHits.longValue());
  }

  @JsonSetter
  public SearchResult setNbHits(Long nbHits) {
    this.nbHits = nbHits;
    return this;
  }

  public Long getNbPages() {
    return nbPages;
  }

  public SearchResult setNbPages(Integer nbPages) {
    return this.setNbPages(nbPages.longValue());
  }

  @JsonSetter
  public SearchResult setNbPages(Long nbPages) {
    this.nbPages = nbPages;
    return this;
  }

  public Long getHitsPerPage() {
    return hitsPerPage;
  }

  public SearchResult setHitsPerPage(Integer hitsPerPage) {
    return this.setHitsPerPage(hitsPerPage.longValue());
  }

  @JsonSetter
  public SearchResult setHitsPerPage(Long hitsPerPage) {
    this.hitsPerPage = hitsPerPage;
    return this;
  }

  public Long getProcessingTimeMS() {
    return processingTimeMS;
  }

  public SearchResult setProcessingTimeMS(Integer processingTimeMS) {
    return this.setProcessingTimeMS(processingTimeMS.longValue());
  }

  @JsonSetter
  public SearchResult setProcessingTimeMS(Long processingTimeMS) {
    this.processingTimeMS = processingTimeMS;
    return this;
  }

  public Map> getFacets() {
    return facets;
  }

  public SearchResult setFacets(Map> facets) {
    this.facets = facets;
    return this;
  }

  public Boolean getExhaustiveFacetsCount() {
    return exhaustiveFacetsCount;
  }

  public SearchResult setExhaustiveFacetsCount(Boolean exhaustiveFacetsCount) {
    this.exhaustiveFacetsCount = exhaustiveFacetsCount;
    return this;
  }

  public String getQuery() {
    return query;
  }

  public SearchResult setQuery(String query) {
    this.query = query;
    return this;
  }

  public String getParams() {
    return params;
  }

  public SearchResult setParams(String params) {
    this.params = params;
    return this;
  }

  public String getIndex() {
    return index;
  }

  public SearchResult setIndex(String index) {
    this.index = index;
    return this;
  }

  public Boolean getProcessed() {
    return processed;
  }

  public SearchResult setProcessed(Boolean processed) {
    this.processed = processed;
    return this;
  }

  public String getQueryID() {
    return queryID;
  }

  public SearchResult setQueryID(final String queryID) {
    this.queryID = queryID;
    return this;
  }

  public Map getFacets_stats() {
    return facets_stats;
  }

  public SearchResult setFacets_stats(Map facets_stats) {
    this.facets_stats = facets_stats;
    return this;
  }

  public int getObjectPosition(@Nonnull String objectID, @Nonnull Class clazz) {
    return IntStream.range(0, hits.size())
        .filter(i -> objectID.equals(AlgoliaUtils.getObjectID(hits.get(i), clazz)))
        .findFirst()
        .orElse(-1);
  }

  public Boolean getExhaustiveNbHits() {
    return exhaustiveNbHits;
  }

  public SearchResult setExhaustiveNbHits(Boolean exhaustiveNbHits) {
    this.exhaustiveNbHits = exhaustiveNbHits;
    return this;
  }

  public Integer getAppliedRelevancyStrictness() {
    return appliedRelevancyStrictness;
  }

  public SearchResult setAppliedRelevancyStrictness(Integer appliedRelevancyStrictness) {
    this.appliedRelevancyStrictness = appliedRelevancyStrictness;
    return this;
  }

  public Integer getNbSortedHits() {
    return nbSortedHits;
  }

  public SearchResult setNbSortedHits(Integer nbSortedHits) {
    this.nbSortedHits = nbSortedHits;
    return this;
  }

  @Override
  public String toString() {
    return "SearchResult{"
        + "page="
        + page
        + ", nbHits="
        + nbHits
        + ", nbPages="
        + nbPages
        + ", hitsPerPage="
        + hitsPerPage
        + ", processingTimeMS="
        + processingTimeMS
        + ", facets="
        + facets
        + ", facets_stats="
        + facets_stats
        + ", exhaustiveFacetsCount="
        + exhaustiveFacetsCount
        + ", query='"
        + query
        + '\''
        + ", params='"
        + params
        + '\''
        + ", hits="
        + hits
        + ", index='"
        + index
        + '\''
        + ", processed="
        + processed
        + '\''
        + ", exhaustiveNbHits="
        + exhaustiveNbHits
        + '\''
        + ", appliedRelevancyStrictness="
        + appliedRelevancyStrictness
        + '\''
        + ", nbSortedHits="
        + nbSortedHits
        + '\''
        + ", renderingContent="
        + renderingContent
        + '\''
        + ", abTestID="
        + abTestID
        + '}';
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy