Class FacetView

java.lang.Object
edu.byu.hbll.box.impl.View
edu.byu.hbll.box.impl.FacetView
All Implemented Interfaces:
BoxConfigurable, BoxDatabase, Harvester, Processor, ReadOnlyDatabase

public class FacetView extends View
A view that translates a facet value into an id and includes all documents with that facet in the final document.

NOTE: when using the builder, you will need to make sure that @box.facets is included in the field projection.

IMPORTANT: FacetView has some weaknesses. First, you cannot force the process of upstream documents based on a facet. A facet is one-way. Documents get tagged with a facet once they've been processed another way. Second, when a document drops its facet value recognized by this view, it is impossible to know which group it once belonged to in order to signal the reprocess of the group. Therefore it is good practice to occasionally reprocess documents dependent on this view. Third, all documents corresponding to a facet id are brought in. If there are many many documents per facet id, the resulting facet documents could be too large to fit in memory. Set the documentLimit in this case.

Author:
Charles Draper
  • Constructor Details

  • Method Details

    • postConstruct

      public void postConstruct(ConstructConfig config)
      Description copied from class: View
      Called when Box constructs a new instance of the class.

      uri: base URI for the box instance, the path should end with /box or a specific source /SOURCE_NAME (required if local is also null)

      local: source name for underlying local source, uri is ignored if this is set.

      fields: array of the particular fields to return for each document (optional)

      statuses: only include documents with these statuses. Default: [READY,DELETED] (optional)

      facets: filter to these collections only, key value pairs in the form of "name:value" (optional)

      limit: limit of documents per request (optional)

      username: username to use with basic authentication. (optional)

      password: password to use with basic authentication. (optional)

      Specified by:
      postConstruct in interface BoxConfigurable
      Overrides:
      postConstruct in class View
      Parameters:
      config - configuration for this client.
    • postInit

      public void postInit(InitConfig config)
      Description copied from interface: BoxConfigurable
      Called after Box is completely initialized.
      Specified by:
      postInit in interface BoxConfigurable
      Overrides:
      postInit in class View
      Parameters:
      config - configuration for this client.
    • rawFind

      public QueryResult rawFind(BoxQuery query)
      Description copied from class: View
      Same as View.find(BoxQuery) except it does not perform any transformation other than applying the preconfigured `fields`, `facets`, and `statuses`.
      Overrides:
      rawFind in class View
      Parameters:
      query - the query to run against the underlying source
      Returns:
      the query result