Table of Contents

Class QueryHelper

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

The Class QueryHelper helps to work with queries

public static class QueryHelper
Inheritance
QueryHelper
Inherited Members

Methods

ConvertToQuery(XElement)

Converts xml object into query

public static IQuery ConvertToQuery(XElement obj)

Parameters

obj XElement

The object to be converted into query

Returns

IQuery

Query instance

ConvertToXml(IQuery)

Converts query into xml element

public static XElement ConvertToXml(IQuery query)

Parameters

query IQuery

The query to be converted

Returns

XElement

Query in xml element representation

CopyQuery(IQuery)

public static IQuery CopyQuery(IQuery query)

Parameters

query IQuery

Returns

IQuery

GetAllQueries()

Get all queries

public static IEnumerable<IQuery> GetAllQueries()

Returns

IEnumerable<IQuery>

GetPimQueries()

Get smart search queries

public static IEnumerable<IQuery> GetPimQueries()

Returns

IEnumerable<IQuery>

GetQueryById(Guid)

public static IQuery? GetQueryById(Guid id)

Parameters

id Guid

Returns

IQuery

GetSortInformation(IQuery, string, IList<SortDirection>)

public static IList<SortInfo> GetSortInformation(IQuery query, string sortBy, IList<SortDirection> sortDirections)

Parameters

query IQuery
sortBy string
sortDirections IList<SortDirection>

Returns

IList<SortInfo>

GetTypeNameFromObject(object?)

Gets type name of object

public static string? GetTypeNameFromObject(object? value)

Parameters

value object

The object

Returns

string

Name of object type including assembly name

Merge(XElement, IQuery)

Merges query to xml element

public static void Merge(XElement element, IQuery query)

Parameters

element XElement

Xml element instance

query IQuery

Query instance

ParseQueryParameters(IQuery, string, NameValueCollection)

public static Dictionary<string, object> ParseQueryParameters(IQuery query, string indexQueryConditions, NameValueCollection requestValues)

Parameters

query IQuery
indexQueryConditions string
requestValues NameValueCollection

Returns

Dictionary<string, object>

ParseQueryParametersFromJson(string)

public static IEnumerable<QueryParameter> ParseQueryParametersFromJson(string queryJson)

Parameters

queryJson string

Returns

IEnumerable<QueryParameter>

ParseQuerySortParametersFromJson(string)

public static IEnumerable<SortInfo> ParseQuerySortParametersFromJson(string queryJson)

Parameters

queryJson string

Returns

IEnumerable<SortInfo>

RemoveQueryFromCache(IQuery)

public static void RemoveQueryFromCache(IQuery query)

Parameters

query IQuery

SerializeIndexQueryParameters(IEnumerable<QueryParameter>)

public static string SerializeIndexQueryParameters(IEnumerable<QueryParameter> parameters)

Parameters

parameters IEnumerable<QueryParameter>

Returns

string

SerializeIndexQuerySortParameters(IEnumerable<SortInfo>)

public static string SerializeIndexQuerySortParameters(IEnumerable<SortInfo> querySortParameters)

Parameters

querySortParameters IEnumerable<SortInfo>

Returns

string

SetQueryToCache(IQuery)

public static void SetQueryToCache(IQuery query)

Parameters

query IQuery

TransformIndexQueryParameters(string, IEnumerable<QueryParameter>, ref bool)

Transforms query parameters json into collection of QueryParameter

public static IEnumerable<QueryParameter> TransformIndexQueryParameters(string queryJson, IEnumerable<QueryParameter> defaultValues, ref bool isDefault)

Parameters

queryJson string

The json string

defaultValues IEnumerable<QueryParameter>

The default parameters to be returned if transform failed

isDefault bool

The value indicating whether default parameters are used

Returns

IEnumerable<QueryParameter>

collection of QueryParameter

TransformIndexQuerySortParameters(string, IEnumerable<SortInfo>, bool, ref bool)

Transforms query parameters json into collection of SortInfo

public static IEnumerable<SortInfo> TransformIndexQuerySortParameters(string queryJson, IEnumerable<SortInfo> defaultValues, bool useDefaultIfEmpty, ref bool isDefault)

Parameters

queryJson string

The json string

defaultValues IEnumerable<SortInfo>

The default parameters to be returned if transform failed

useDefaultIfEmpty bool

Demonstrates that default values will be used if json represents an empty collection. Otherwise, the result will be an empty collection.

isDefault bool

The value indicating whether default parameters are used

Returns

IEnumerable<SortInfo>

TryParseQueryParametersFromJson(string, out IEnumerable<QueryParameter>)

public static bool TryParseQueryParametersFromJson(string queryJson, out IEnumerable<QueryParameter> queryParameters)

Parameters

queryJson string
queryParameters IEnumerable<QueryParameter>

Returns

bool

TryParseQuerySortParametersFromJson(string, out IEnumerable<SortInfo>)

public static bool TryParseQuerySortParametersFromJson(string queryJson, out IEnumerable<SortInfo> queryParameters)

Parameters

queryJson string
queryParameters IEnumerable<SortInfo>

Returns

bool
To top