Skip to main content

App

Contains all the CCApp informations

Computed values

customizationJson

Get the customization json object

info

By default the custom json is empty

Usage

const json = inject(AppStore).customizationJson;
// Output: {}

sources

Get the sources's customizations object.
This configuration is pre-configured in Sinequa 11.12+.

caution

Available only in Sinequa 11.12+

Sources configuration extract
{
"sources": {
"collection": {
"/test/legifrance/": {
"iconClass": "fa-kit fa-legifrance"
},
"/web/wiki2/": {
"iconClass": "fas fa-box-archive"
}
},
"source": {
"sinequa": {
"iconClass": "fa-kit fa-sinequa"
},
"web": {
"iconClass": "fab fa-chrome"
}
},
"connector": {
"confluence.v6.rest": {
"iconClass": "fa-brands fa-confluence"
},
"confluence.v7.rest": {
"iconPath": "/r/confluence.png"
},
"crawler2": {
"iconClass": "fas fa-champagne-glasses"
}
}
}
}

Usage

const json = inject(AppStore).sources;

filters

Get the filters's configuration object.

caution

Available only in Sinequa 11.12+

{
"filters": [
{ "column": "geo", "icon": "fa-solid fa-earth-europe", "hidden": false }
]
}

Usage

const json = inject(AppStore).filters;

Basic features

initialize()

Initializes the application state by fetching the app data from the appService and updating the store with the retrieved data.

initialize(): Promise<void>
warning

This method must be called just after the login step because you need to be authenticated first.

initializeWithAppName()

Initializes the application state with the provided app name.

initializeWithAppName(appName: string): Promise<void>
ParameterTypeDescription
appNamestringThe name of the application to fetch the configuration for.

update()

Updates the application state with the provided CCApp object.

update(app: CCApp): void
parametertypedescription
appCCAppThe new CCApp object to update the state with.

getColumn()

Retrieves a column definition from the application's state schema by its name.

Returns The column definition as a CCColumn object if found, or undefined if the column does not exist.

getColumn(column: string): CCColumn | undefined
parametertypedescription
columnstringThe name of the column to retrieve.

getColumnAlias()

Retrieves the alias of a column from the store.

Returns The alias of the specified column, or the column name if no alias is found.

getColumnAlias(column: string): string
parametertypedescription
columnstringThe name of the column for which to retrieve the alias.

Usage

const alias = inject(AppStore).getColumnAlias("geo");
// Output: "geo"

isDateColumn()

Determines if the specified column is of a date-related type.

Returns true if the column is of a date-related type otherwise false.

isDateColumn(column: string): boolean
parametertypedescription
columnstringThe name of the column to check.
note

This method checks if the column's type matches one of the following:

  • EngineType.date
  • EngineType.dateTime
  • EngineType.time

Usage

is-date-column.ts
const isDate = inject(AppStore).isDateColumn("created");
// Output: true if the column type is date, dateTime, or time

isTabSearch()

Determines if the specified query has a tab search configuration. Returns true if the query has a tab search configuration, otherwise false.

isTabSearch(queryName: string): boolean
parametertypedescription
queryNamestringThe name of the query to check for tab search configuration.

getAggregationCount()

Retrieves the count of items in the specified aggregation.

getAggregationCount(queryName: string, aggregationName: string): number
parametertypedescription
queryNamestringThe name of the query to retrieve the aggregation count for.
aggregationNamestringThe name of the aggregation to retrieve the count for.

getAuthorizedFilters()

Retrieves the sorted aggregations based on the query name included in the route data.

Returns an array of sorted aggregations.

getAuthorizedFilters(route: ActivatedRoute): Aggregation[]
parametertypedescription
routeActivatedRouteThe activated route containing the query name in its data.

Usage

const route = inject(ActivatedRoute);
const aggregations = inject(AppStore).getAuthorizedFilters(route);
// Output: [{ column: "geo", icon: "fa-solid fa-earth-europe", hidden: false }]

Customization features

Customization JSON files

NameDescription
customizationJsonRetrieves the customization JSON object from the store.
sourcesReturns the sources customization object.
filtersReturns the filters customization object.
generalReturns the general customization object.
assistantsReturns the assistants customization object.

getNamedCustomizationJson()

Retrieves the customization json by name

Returns The customization json object or undefined if not found

caution

Available only in Sinequa 11.12+

getNamedCustomizationJson(name: string): any
parametertypedescription
namestringThe name of the customization json.

Usage

const json = inject(AppStore).getNamedCustomizationJson("routes");

Web Services features

getWebServiceByType()

Returns the web service object if found, otherwise undefined.

getWebServiceByType(type: CCWebService['webServiceType']): CCWebService | undefined
parametertypedescription
typeCCWebService['webServiceType']Web service type name.
info

CCWebService['webServiceType'] is as special type to allow autocomplete.

Value can be 'Autocomplete' | 'DataSets' | 'Labels' | 'Preview' | 'Query' | 'queryexport' | 'sponsoredlinks'

Usage

some-component.ts
@Component({ ... })
export class SomeComponent {

const preview = inject(AppStore).getWebServiceByType('Preview');
}

Labels features

getLabels()

Retrieves the private and public labels from the web service.

Returns An object { private: string, public: string } containing the private and public labels.
If the labels are not found, returns an object with empty strings for both fields.

getLabels(): { private: string, public: string }

allowLabels()

Checks if the labels web service is available.

Usage

some-component.ts
@Component({ ... })
export class SomeComponent {

labels = inject(AppStore).getLabels();
// { private: '...', public: '...'}
}

Queries features

getQueryByName()

Retrieves a query by its name from the store.

Returns The CCQuery object if found, otherwise undefined.

getQueryByName(name: string): CCQuery | undefined
parametertypedescription
namestringThe name of the query to retrieve.

Usage

some-component.ts
@Component({ ... })
export class SomeComponent {

query: CCQuery = inject(AppStore).getQueryByName('_query');
}

getQueryByIndex()

Retrieves a query by its index from the store.

Returns The query object if found, otherwise undefined.

getQueryByIndex(index: number): CCQuery | undefined
parametertypedescription
indexnumberThe index of the query to retrieve.

Usage

some-component.ts
@Component({ ... })
export class SomeComponent {

query: CCQuery = inject(AppStore).getQueryByIndex(0);
// returns the default query set in the Sinequa administration
}

getDefaultQuery()

Retrieves the default query.

Returns the default CCQuery if it exists, otherwise undefined.

getDefaultQuery(): CCQuery | undefined
important

The default query is always the first query in the list of queries.

Usage

some-component.ts
@Component({ ... })
export class SomeComponent {

query: CCQuery = inject(AppStore).getDefaultQuery();
// returns the default query set in the Sinequa administration
}
tip

This is a convenient way instead of getQueryNameByIndex(0)

allowEmptySearch()

Retrieves the allowEmptySearch flag for a specific query.

Returns The allowEmptySearch value for the specified query, or false if not found.

allowEmptySearch(queryName: string): boolean
parametertypedescription
queryNamestringThe name of the query for which to retrieve allow empty search flag.

Usage

some-component.ts
@Component({ ... })
export class SomeComponent {

allowEmptySearch: boolean = inject(AppStore).allowEmptySearch('_query');
// returns true or false depending the flag set in Sinequa Administration
}

Aggregations features

getAggregationIcon()

Retrieves the icon associated with a given column's aggregation.

Returns the icon value associated with the specified column's aggregation, or undefined if no matching aggregation is found.

getAggregationIcon(column: string): string | undefined
parametertypedescription
columnstringThe name of the column for which to retrieve the aggregation icon.
get-aggregation-icon.ts
// json Aggregation configuration extract
{
aggregations: [
{
column: "geo",
icon?: "fas fa-globe",
display?: "Places",
hidden?: false,
items?: [{ value: "Madrid", icon?: "fas fa-map" }]
}
]
}

const icon = inject(AppStore).getAggregationIcon("geo");
// Output: "fas fa-globe"

getAggregationCustomization()

Retrieves the customization for a specific aggregation column.

Returns The customization object for the specified column, or undefined if not found.

getAggregationCustomization(column: string): Aggregation | undefined
parametertypedescription
columnstringThe column name for which to retrieve the customization.
get-aggregation-customization
// json Aggregation configuration extract
{
aggregations: [
{
column: "geo",
icon?: "fas fa-globe",
display?: "Places",
hidden?: false,
items?: [{ value: "Madrid", icon?: "fas fa-map" }]
}
]
}

const conf = inject(AppStore).getAggregationCustomization("geo");
// Output:
{
column: "geo",
icon?: "fas fa-globe",
display?: "Places",
hidden?: false,
items?: [{ value: "Madrid", icon?: "fas fa-map" }]
}

getAggregationItemsCustomization()

Retrieves the customization items for a given column from the store's filters.

Returns An array of CFilterItem objects if found, otherwise undefined.

getAggregationItemsCustomization(column: string): CFilterItem[] | undefined
parametertypedescription
columnstringThe name of the column for which to retrieve the aggregation icon.
get-aggregation-items-customization.ts
// json Aggregation configuration extract
{
aggregations: [
{
column: "geo",
icon?: "fas fa-globe",
display?: "Places",
hidden?: false,
items?: [{ value: "Madrid", icon?: "fas fa-map" }]
}
]
}

const items = inject(AppStore).getAggregationItemsCustomization("geo");
// Output: [{ value: "Madrid", icon: "fas fa-map" }]

isAssistantAllowed()

Determines whether a specific assistant is allowed based on its presence and configuration in the store.

isAssistantAllowed(assistantName: string): boolean
ParameterTypeDescription
assistantNamestringThe name of the assistant to check.
check-assistant-allowed.ts
const isAllowed = inject(AppStore).isAssistantAllowed("summarization");
// Output: true/false based on whether the assistant exists and has service_id configured