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

com.groupbyinc.api.model.Record Maven / Gradle / Ivy

There is a newer version: 198
Show newest version
package com.groupbyinc.api.model;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;
import java.util.Map;

/**
 * 
 * A Record represents a result from the search engine.
 * Each record has all the requested metadata as
 * specified in fields parameter.  Each record also has several special fields.
 *
 * - `id`: an MD5 hash of the unique URL of this record.
 * - `url`: the unique url of the record.
 * - `snippet`: If there is a keyword match, the snippet of text.  Matches have <b> tags surrounding them.
 * - `title`: The title of the record.
 * - `allMeta`: a map of key value pairs.  If a value is multi-assign, there will additionally be a <key>List
 * item, with all the values.
 * 
 */
public class Record {

  private List refinementMatches;
  private String collection;
  @JsonProperty("_id") private String id;
  @JsonProperty("_u") private String url;
  @JsonProperty("_snippet") private String snippet;
  @JsonProperty("_t") private String title;
  private Map allMeta;

  /**
   * @internal
   */
  public List getRefinementMatches() {
    return refinementMatches;
  }

  /**
   * @internal
   * @param refinementMatches The list of refinement matches
   */
  public com.groupbyinc.api.model.Record setRefinementMatches(List refinementMatches) {
    this.refinementMatches = refinementMatches;
    return this;
  }

  /**
   * @return The collection that this record belongs to.
   */
  public String getCollection() {
    return collection;
  }

  public com.groupbyinc.api.model.Record setCollection(String collection) {
    this.collection = collection;
    return this;
  }

  /**
   * @return The ID is generated from URL of this record which means it will
   * persist across updates.
   */
  public String getId() {
    return id;
  }

  /**
   * @param id
   *         Set the id
   */
  public com.groupbyinc.api.model.Record setId(String id) {
    this.id = id;
    return this;
  }

  /**
   * 
   * This URL is generated by the data upload service and follows the format
   *
   *     http://1.com/.html
   * 
   *
   * @return The URL represents the Unique ID of the record.
   */
  public String getUrl() {
    return url;
  }

  /**
   * @param url
   *         Set the record url
   */
  public com.groupbyinc.api.model.Record setUrl(String url) {
    this.url = url;
    return this;
  }

  /**
   * @return If a search was performed this result object may have a snippet
   * of matching text.
   */
  public String getSnippet() {
    return snippet;
  }

  /**
   * @param snippet
   *         Set the snippet
   */
  public com.groupbyinc.api.model.Record setSnippet(String snippet) {
    this.snippet = snippet;
    return this;
  }

  /**
   * @param name
   *         Get a specific metadata value. Essentially this represents an
   *         attribute of the record data.
   */
  public Object getMetaValue(String name) {
    return allMeta.get(name);
  }

  /**
   * @return A map of all the metadata associated with this record.
   */
  public Map getAllMeta() {
    return allMeta;
  }

  /**
   * @param allMeta
   *         Set the metadata.
   */
  public com.groupbyinc.api.model.Record setAllMeta(Map allMeta) {
    this.allMeta = allMeta;
    return this;
  }

  /**
   * 
   * The title of this record
   * 
   *
   * @return The title of this record.
   */
  public String getTitle() {
    return title;
  }

  /**
   * @param title
   *         Set the title
   */
  public com.groupbyinc.api.model.Record setTitle(String title) {
    this.title = title;
    return this;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy