Packages

object SearchFacet

A facet definition for FacetSearchCollector.

Annotations
@Beta()
Since

4.7

See also

Facet definition

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SearchFacet
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. def combineToBson(facets: Iterable[_ <: SearchFacet]): Bson

    Combines SearchFacets into a Bson.

    Combines SearchFacets into a Bson.

    This method may be useful when using SearchCollector.of.

    facets

    The non-empty facet definitions to combine.

    returns

    A Bson representing combined facets.

  2. def dateFacet(name: String, path: FieldSearchPath, boundaries: Iterable[Instant]): DateSearchFacet

    Returns a SearchFacet that allows determining the frequency of BSON Date values in the search results by breaking the results into separate ranges.

    Returns a SearchFacet that allows determining the frequency of BSON Date values in the search results by breaking the results into separate ranges.

    name

    The facet name.

    path

    The path to facet on.

    boundaries

    Bucket boundaries in ascending order. Must contain at least two boundaries.

    returns

    The requested SearchFacet.

    See also

    Date facet definition

    org.bson.codecs.jsr310.InstantCodec

  3. def numberFacet(name: String, path: FieldSearchPath, boundaries: Iterable[Number]): NumberSearchFacet

    Returns a SearchFacet that allows determining the frequency of BSON 32-bit integer / 64-bit integer / Double values in the search results by breaking the results into separate ranges.

    Returns a SearchFacet that allows determining the frequency of BSON 32-bit integer / 64-bit integer / Double values in the search results by breaking the results into separate ranges.

    name

    The facet name.

    path

    The path to facet on.

    boundaries

    Bucket boundaries in ascending order. Must contain at least two boundaries.

    returns

    The requested SearchFacet.

    See also

    Numeric facet definition

  4. def of(facet: Bson): SearchFacet

    Creates a SearchFacet from a Bson in situations when there is no builder method that better satisfies your needs.

    Creates a SearchFacet from a Bson in situations when there is no builder method that better satisfies your needs. This method cannot be used to validate the syntax.

    Example
    The following code creates two functionally equivalent SearchFacets, though they may not be equal.

    val facet1: SearchFacet = SearchFacet.stringFacet("facetName",
      SearchPath.fieldPath("fieldName"))
    val facet2: SearchFacet = SearchFacet.of(Document("facetName" -> Document("type" -> "string",
      "path" -> SearchPath.fieldPath("fieldName").toValue)))
    facet

    A Bson representing the required SearchFacet.

    returns

    The requested SearchFacet.

  5. def stringFacet(name: String, path: FieldSearchPath): StringSearchFacet

    Returns a SearchFacet that allows narrowing down search results based on the most frequent BSON String values of the specified field.

    Returns a SearchFacet that allows narrowing down search results based on the most frequent BSON String values of the specified field.

    name

    The facet name.

    path

    The field to facet on.

    returns

    The requested SearchFacet.

    See also

    String facet definition