Class

Search

Search()

Constructor

Creates a new search object.

Methods

add(filter) → {Search}

Add a search filter.

Parameters:
Name Type Description
filter SearchFilter

filter to add

search object with filter added

Search

addAlphabeticalSort(descending) → {Search}

Add alphabetical sort to this search

Parameters:
Name Type Description
descending boolean

If the results should be sorted in descending (true) or ascending (false) order.

search object with sort added

Search

addCustomFieldSort(fieldName, descending) → {Search}

Add a sort for custom value to this search

Parameters:
Name Type Description
fieldName string

attribute to add sort for

descending boolean

If the results should be sorted in descending (true) or ascending (false) order.

search object with sort added

Search

find(page, hitsPerPage) → {ArrayLike.<Page>}

Executes the search and collects the results. Returns a specific page with a maximum of hits.

Parameters:
Name Type Description
page number

the page number to find

hitsPerPage number

the number of results per page

List of all pages that matches this search.

ArrayLike.<Page>

findAllPages() → {ArrayLike.<Page>}

Executes the search and collects the results. If no filter was set, an all() filter is applied.

List of all pages that matches this search.

ArrayLike.<Page>

getHitCount() → {number}

Fetches the count of found pages.

The amount of pages found by this search.

number

getTermFrequenciesForField(field)

Gets the term frequencies for a specific field

Parameters:
Name Type Description
field string

the name of the field

a map containing the term frequencies

getTermFrequenciesForFields(…fields)

Gets the term frequencies for specific fields

Parameters:
Name Type Attributes Description
fields string <repeatable>

the names of the fields

a map containing submaps with the term frequencies

setEmbeddingEntity(entity) → {Search}

Sets the embedding entity of the search to the given page. This is necessary when using relative filters like Filters.embeddingSpace() to provide a point of reference for these as embedding is not handled automatically in cplaceJS.

Parameters:
Name Type Description
entity CustomEntity

The entity to set as the embedding reference of the search.

search object with embedding entity set

Search