Table of Contents

Interface IQueryService

Namespace
Dynamicweb.Indexing.Querying
Assembly
Dynamicweb.Core.dll

Service for working with stored queries and their facet groups — loading, saving, moving, copying and deleting them on disk — and for executing a query against its source provider.

public interface IQueryService

Remarks

Queries are persisted as .query files and facet groups as .facets files. Both can be addressed either by an absolute file path or by a (repository, item) pair resolved relative to the system repositories root. Resolve an instance from DI via DependencyResolver.Current.GetRequiredService<IQueryService>() or constructor injection.

Methods

CopyQuery(string, IQuery)

Creates a copy of an existing query at a new location, leaving the original in place and duplicating its configuration.

ApplicationResponse<IQuery> CopyQuery(string fileName, IQuery query)

Parameters

fileName string

The absolute destination path for the new copy, including the file name (e.g. ...\MyQueryCopy.query); the copy's Name is derived from this file name. Must not already exist; the destination folder is created if it is missing.

query IQuery

The source query to copy from. It is not modified.

Returns

ApplicationResponse<IQuery>

A succeeded response carrying the newly created copy, or a failed response whose message explains why (empty or duplicate destination).

DeleteQuery(IQuery)

Deletes the given query, removing its file (if present) and configuration.

void DeleteQuery(IQuery query)

Parameters

query IQuery

The query to delete.

DeleteQuery(string)

Deletes the query with the given id, removing its file and configuration. Does nothing if queryId is not a valid GUID or no matching query exists.

void DeleteQuery(string queryId)

Parameters

queryId string

The query's unique id, as a GUID string.

LoadFacets(string)

Loads the facet group stored at an absolute file path.

IFacetGroup? LoadFacets(string fileName)

Parameters

fileName string

Absolute path to the facets file; the .facets extension is applied automatically.

Returns

IFacetGroup

The loaded facet group, or null if fileName is empty or the file does not exist.

LoadFacets(string, string)

Loads the facet group stored at item within repository, resolved relative to the system repositories root.

IFacetGroup? LoadFacets(string repository, string item)

Parameters

repository string

The repository folder name. Paths and names consisting only of dots after trimming whitespace are not accepted.

item string

The facet group file name within repository. The .facets extension is applied automatically. Paths and names consisting only of dots after trimming whitespace are not accepted.

Returns

IFacetGroup

The loaded facet group, or null if either argument is not a valid name or no matching facets file exists.

LoadQuery(string)

Loads the query stored at an absolute file path.

IQuery? LoadQuery(string fileName)

Parameters

fileName string

Absolute path to the query file; the .query extension is applied automatically.

Returns

IQuery

The loaded query, or null if fileName is empty or the file does not exist.

LoadQuery(string, string)

Loads the query stored at item within repository, resolved relative to the system repositories root.

IQuery? LoadQuery(string repository, string item)

Parameters

repository string

The repository folder name. Paths and names consisting only of dots after trimming whitespace are not accepted.

item string

The query file name within repository. The .query extension is applied automatically. Paths and names consisting only of dots after trimming whitespace are not accepted.

Returns

IQuery

The loaded query, or null if either argument is not a valid name or no matching query file exists.

MoveQuery(string, IQuery)

Moves an existing query file to a new location, taking its saved configuration with it. The query is read from its current path (query's FileName) and relocated to fileName.

ApplicationResponse<IQuery> MoveQuery(string fileName, IQuery query)

Parameters

fileName string

The absolute destination path the query file is moved to, including the file name (e.g. ...\MyQuery.query). Must differ from the query's current path and must not already exist; the destination folder is created if it is missing.

query IQuery

The existing query to move. Its FileName must point to the current file and is updated to fileName on success.

Returns

ApplicationResponse<IQuery>

A succeeded response carrying the moved query, or a failed response whose message explains why (empty or duplicate destination, missing source file, or a move to the same location).

Query(IQuery, QuerySettings)

Executes query against its source provider and returns the result.

IQueryResult? Query(IQuery query, QuerySettings settings)

Parameters

query IQuery

The query to execute.

settings QuerySettings

Settings controlling execution, such as paging.

Returns

IQueryResult

The query result, or null if the query's source has no provider.

SaveFacets(string, IFacetGroup)

Saves facets to an absolute file path, creating the file or updating it in place. The .facets extension is applied automatically.

void SaveFacets(string fileName, IFacetGroup facets)

Parameters

fileName string

Absolute path to the facets file.

facets IFacetGroup

The facet group to save.

SaveFacets(string, string, IFacetGroup)

Saves facets to item within repository, resolved relative to the system repositories root.

void SaveFacets(string repository, string item, IFacetGroup facets)

Parameters

repository string

Repository (folder) name under the repositories root.

item string

Item (file) name within the repository.

facets IFacetGroup

The facet group to save.

SaveQuery(string, IQuery)

Saves query to an absolute file path, creating the file or updating it in place. The .query extension is applied automatically, and if the file's name differs from query's Name the file is renamed to match.

void SaveQuery(string fileName, IQuery query)

Parameters

fileName string

Absolute path to the query file.

query IQuery

The query to save.

SaveQuery(string, string, IQuery)

Saves query to item within repository, resolved relative to the system repositories root.

void SaveQuery(string repository, string item, IQuery query)

Parameters

repository string

Repository (folder) name under the repositories root.

item string

Item (file) name within the repository.

query IQuery

The query to save.

To top