Home Reference Source

Function

Static Public Summary
public

allFilters(filters: Filter[]): Filter

Creates an All Filter.

public

anyFilters(filters: Filter[]): Filter

Creates an Any Filter.

public

body(text: string, weight: number): Body

Creates a body object

public

bucket(name: string, filter: Filter): Bucket

Creates a Bucket object.

public

bucketAggregate(name: string, buckets: bucket[]): Aggregate

Creates a Bucket Aggregate Object.

public

Creates a Count Aggregate Object.

public

Creates an Element Field Boost.

public

Creates a FeatureFieldBoost from a FieldBoost

public

fieldFilter(field: Field, operator: string, values: *): Filter

Create a Field Filter.

public

Creates a Field Instance Boost.

public

Creates a Filter Field Boost.

public

geoFilter(field_lat: Field, field_lng: Field, lat: number, lng: number, radius: radius, region: GeoRegion): Filter

Creates a Geo Filter.

public

Creates an Interval Field Boost.

public

Creates a Metric Aggregate Object.

public

noneOfFilters(filters: Filter[]): Filter

Creates a None Of Filter.

public

oneOfFilters(filters: Filter[]): Filter

Creates a One Of Filter.

public

pipeline(name: *, values: *, tracking: *): {"pipeline": *, "values": *, "tracking": *}

public

pointValue(point: number, value: number): PointValue

Creates a Point Value for use in an Interval Field Boost.

public

scoreInstanceBoost(threshold: number, minCount: number): InstanceBoost

Creates a Score Instance Boost.

public

sort(field: Field): Sort

Creates a Sort object.

public

TextFieldBoost represents a text-based boosting for string fields.

Static Public

public allFilters(filters: Filter[]): Filter source

import {allFilters} from 'sajari/src/sajari.js'

Creates an All Filter. An All filter will resolve to True only if all it's child filters resolve to True.

Params:

NameTypeAttributeDescription
filters Filter[]

The child filters.

Return:

Filter

public anyFilters(filters: Filter[]): Filter source

import {anyFilters} from 'sajari/src/sajari.js'

Creates an Any Filter. An Any filter will resolve to True if at least one of it's child filters resolve to True.

Params:

NameTypeAttributeDescription
filters Filter[]

The child filters.

Return:

Filter

public body(text: string, weight: number): Body source

import {body} from 'sajari/src/sajari.js'

Creates a body object

Params:

NameTypeAttributeDescription
text string

The text to use for the body.

weight number
  • optional
  • default: 1

The weight to give the body.

Return:

Body

A body object.

public bucket(name: string, filter: Filter): Bucket source

import {bucket} from 'sajari/src/sajari.js'

Creates a Bucket object.

Params:

NameTypeAttributeDescription
name string

The name of the bucket.

filter Filter

The filter fo use as the classifier.

Return:

Bucket

The bucket object.

public bucketAggregate(name: string, buckets: bucket[]): Aggregate source

import {bucketAggregate} from 'sajari/src/sajari.js'

Creates a Bucket Aggregate Object.

Params:

NameTypeAttributeDescription
name string

The name of the Bucket Aggregate.

buckets bucket[]

The buckets to use.

Return:

Aggregate

public countAggregate(name: string, field: Field): Aggregate source

import {countAggregate} from 'sajari/src/sajari.js'

Creates a Count Aggregate Object.

Params:

NameTypeAttributeDescription
name string

The name of the aggregate.

field Field

The field to aggregate.

Return:

Aggregate

A Count Aggregate Object.

public elementFieldBoost(field: Field, elts: string[]): FieldBoost source

import {elementFieldBoost} from 'sajari/src/sajari.js'

Creates an Element Field Boost. ElementFieldBoost represents an element-based boosting for repeated field values. The resulting boost is the proportion of elements in elts that are also in the field value.

Params:

NameTypeAttributeDescription
field Field

The field to boost on.

elts string[]

The elements to use for the boost.

Return:

FieldBoost

public featureFieldBoost(field_boost: FieldBoost, value: number): FeatureFieldBoost source

import {featureFieldBoost} from 'sajari/src/sajari.js'

Creates a FeatureFieldBoost from a FieldBoost

Params:

NameTypeAttributeDescription
field_boost FieldBoost
value number

Return:

FeatureFieldBoost

FeatureFieldBoost object.

public fieldFilter(field: Field, operator: string, values: *): Filter source

import {fieldFilter} from 'sajari/src/sajari.js'

Create a Field Filter.

Operator Description
= Equal to
!= Not equal to
> Greater than
>= Greater than or equal to
< Less than
<= Less than or equal to
~ Contains
!~ Does not contain
^ Has prefix
$ Has suffix

Params:

NameTypeAttributeDescription
field Field

The field to filter on.

operator string

The operator to use.

values *

The value(s) to compare against.

Return:

Filter

Field filter object.

public fieldInstanceBoost(field: Field, value: number): InstanceBoost source

import {fieldInstanceBoost} from 'sajari/src/sajari.js'

Creates a Field Instance Boost. FilterFieldBoost is a boost which is applied to documents which satisfy the filter. Value must be greater than 0. Documents which match the filter will receive a boost of Value.

Params:

NameTypeAttributeDescription
field Field

The field to boost.

value number

The value to boost by.

Return:

InstanceBoost

public filterFieldBoost(filter: Filter, value: number): FieldBoost source

import {filterFieldBoost} from 'sajari/src/sajari.js'

Creates a Filter Field Boost. FilterFieldBoost is a boost which is applied to documents which satisfy the filter. Value must be greater than 0. Documents which match the filter will receive a boost of Value

Params:

NameTypeAttributeDescription
filter Filter

The Filter to use as the condition for the boost.

value number

The value to give the boost.

Return:

FieldBoost

public geoFilter(field_lat: Field, field_lng: Field, lat: number, lng: number, radius: radius, region: GeoRegion): Filter source

import {geoFilter} from 'sajari/src/sajari.js'

Creates a Geo Filter.

Params:

NameTypeAttributeDescription
field_lat Field

The field containing the latitude value.

field_lng Field

The field containing the longitude value.

lat number

The latitude to compare against.

lng number

The longitude to compare against.

radius radius

The radius to restrict the filter to.

region GeoRegion

The region to restrict the filter to.

Return:

Filter

public intervalFieldBoost(field: Field, points: PointValue[]): FieldBoost source

import {intervalFieldBoost} from 'sajari/src/sajari.js'

Creates an Interval Field Boost. IntervalFieldBoost represents an interval-based boost for numeric field values. An interval field boost is defined by a list of points with corresponding boost values. When a field value falls between between two PointValues.Point values is computed linearly.

Params:

NameTypeAttributeDescription
field Field

The field to boost.

points PointValue[]

The points to use as intervals.

Return:

FieldBoost

public metricAggregate(name: string, field: Field, type: MetricType): Aggregate source

import {metricAggregate} from 'sajari/src/sajari.js'

Creates a Metric Aggregate Object.

Params:

NameTypeAttributeDescription
name string

The name of the aggregate.

field Field

The field to aggregate.

type MetricType

The type of metric to gather.

Return:

Aggregate

A Metric Aggregate Object

public noneOfFilters(filters: Filter[]): Filter source

import {noneOfFilters} from 'sajari/src/sajari.js'

Creates a None Of Filter. A None Of filter will resolve to True only if none of it's child filters resolve to True.

Params:

NameTypeAttributeDescription
filters Filter[]

The child filters.

Return:

Filter

public oneOfFilters(filters: Filter[]): Filter source

import {oneOfFilters} from 'sajari/src/sajari.js'

Creates a One Of Filter. A One Of filter will resolve to True only if exactly one of it's child filters resolve to True.

Params:

NameTypeAttributeDescription
filters Filter[]

The child filters.

Return:

Filter

public pipeline(name: *, values: *, tracking: *): {"pipeline": *, "values": *, "tracking": *} source

import {pipeline} from 'sajari/src/sajari.js'

Params:

NameTypeAttributeDescription
name *
values *
tracking *

Return:

{"pipeline": *, "values": *, "tracking": *}

public pointValue(point: number, value: number): PointValue source

import {pointValue} from 'sajari/src/sajari.js'

Creates a Point Value for use in an Interval Field Boost.

Params:

NameTypeAttributeDescription
point number

A point to scale from/to.

value number

The value to give at this point.

Return:

PointValue

public scoreInstanceBoost(threshold: number, minCount: number): InstanceBoost source

import {scoreInstanceBoost} from 'sajari/src/sajari.js'

Creates a Score Instance Boost. ScoreInstanceBoost is a boost applied to index terms which have interaction data set. For an instance score boost to take effect, the instance must have received at least minCount score updates (i.e. count). If an item is performing as it should then its score will be 1. If the score is below threshold (0 < threshold < 1) then the score will be applied.

Params:

NameTypeAttributeDescription
threshold number

Threshold of scoring change required to apply this boost.

minCount number

Minimum number of scores required to apply this boost.

Return:

InstanceBoost

public sort(field: Field): Sort source

import {sort} from 'sajari/src/sajari.js'

Creates a Sort object. Sort defines a sort order for a query.

Params:

NameTypeAttributeDescription
field Field

The field to sort by, prepended by - if it should be descending.

Return:

Sort

public textFieldBoost(field: Field, text: string): FieldBoost source

import {textFieldBoost} from 'sajari/src/sajari.js'

TextFieldBoost represents a text-based boosting for string fields. It compares the text gainst the document field using a bag-of-words model.

Params:

NameTypeAttributeDescription
field Field

The field to boost on.

text string

The text to use for the boost.

Return:

FieldBoost