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
XElementThe 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
IQueryThe query to be converted
Returns
- XElement
Query in xml element representation
CopyQuery(IQuery)
public static IQuery CopyQuery(IQuery query)
Parameters
query
IQuery
Returns
GetAllQueries()
Get all queries
public static IEnumerable<IQuery> GetAllQueries()
Returns
GetPimQueries()
Get smart search queries
public static IEnumerable<IQuery> GetPimQueries()
Returns
GetQueryById(Guid)
public static IQuery? GetQueryById(Guid id)
Parameters
id
Guid
Returns
GetSortInformation(IQuery, string, IList<SortDirection>)
public static IList<SortInfo> GetSortInformation(IQuery query, string sortBy, IList<SortDirection> sortDirections)
Parameters
query
IQuerysortBy
stringsortDirections
IList<SortDirection>
Returns
GetTypeNameFromObject(object?)
Gets type name of object
public static string? GetTypeNameFromObject(object? value)
Parameters
value
objectThe 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
ParseQueryParameters(IQuery, string, NameValueCollection)
public static Dictionary<string, object> ParseQueryParameters(IQuery query, string indexQueryConditions, NameValueCollection requestValues)
Parameters
query
IQueryindexQueryConditions
stringrequestValues
NameValueCollection
Returns
ParseQueryParametersFromJson(string)
public static IEnumerable<QueryParameter> ParseQueryParametersFromJson(string queryJson)
Parameters
queryJson
string
Returns
ParseQuerySortParametersFromJson(string)
public static IEnumerable<SortInfo> ParseQuerySortParametersFromJson(string queryJson)
Parameters
queryJson
string
Returns
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
SerializeIndexQuerySortParameters(IEnumerable<SortInfo>)
public static string SerializeIndexQuerySortParameters(IEnumerable<SortInfo> querySortParameters)
Parameters
querySortParameters
IEnumerable<SortInfo>
Returns
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
stringThe json string
defaultValues
IEnumerable<QueryParameter>The default parameters to be returned if transform failed
isDefault
boolThe 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
stringThe json string
defaultValues
IEnumerable<SortInfo>The default parameters to be returned if transform failed
useDefaultIfEmpty
boolDemonstrates that default values will be used if json represents an empty collection. Otherwise, the result will be an empty collection.
isDefault
boolThe value indicating whether default parameters are used
Returns
TryParseQueryParametersFromJson(string, out IEnumerable<QueryParameter>)
public static bool TryParseQueryParametersFromJson(string queryJson, out IEnumerable<QueryParameter> queryParameters)
Parameters
queryJson
stringqueryParameters
IEnumerable<QueryParameter>
Returns
TryParseQuerySortParametersFromJson(string, out IEnumerable<SortInfo>)
public static bool TryParseQuerySortParametersFromJson(string queryJson, out IEnumerable<SortInfo> queryParameters)
Parameters
queryJson
stringqueryParameters
IEnumerable<SortInfo>