Class QueryHelper
- Namespace
- Dynamicweb.Indexing.Querying
- Assembly
- Dynamicweb.Indexing.dll
The Class QueryHelper helps to work with queries
public static class QueryHelper
- Inheritance
-
QueryHelper
- Inherited Members
Methods
ConvertToJson(IQuery)
Converts query into json object
public static JObject ConvertToJson(IQuery query)
Parameters
query
IQuery- The query to be converted
Returns
- JObject
- Query in json object representation
ConvertToQuery(JObject)
Converts json object into query
public static IQuery ConvertToQuery(JObject obj)
Parameters
obj
JObject- The object to be converted into query
Returns
- IQuery
- Query instance
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
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
GetTypeName(object)
Gets type name of object
[Obsolete("Use GetTypeNameFromObject instead.")]
public static string GetTypeName(object obj)
Parameters
obj
object- The object
Returns
- string
- Name of object type including assembly name
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
LoadQuery(IQueryService, string, RepositoryFileFormat)
Loads query
public static IQuery LoadQuery(this IQueryService queryService, string fileName, RepositoryFileFormat fileFormat)
Parameters
queryService
IQueryService- Query service instance
fileName
string- Path to query file in file system
fileFormat
RepositoryFileFormat- Format of query
Returns
- IQuery
- Query instance
Merge(JObject, IQuery)
Merges query to json object
public static void Merge(JObject json, IQuery query)
Parameters
json
JObject- Json object instance
query
IQuery- Query instance
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
RemoveQueryFromCache(IQuery)
public static void RemoveQueryFromCache(IQuery query)
Parameters
query
IQuery
SaveQuery(IQueryService, string, IQuery, RepositoryFileFormat)
Saves query
public static void SaveQuery(this IQueryService queryService, string fileName, IQuery query, RepositoryFileFormat fileFormat)
Parameters
queryService
IQueryService- Query service instance
fileName
string- Path to query file in file system
query
IQuery- The query
fileFormat
RepositoryFileFormat- Format of query
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
TransformIndexQuerySortParams(string, IEnumerable<SortInfo>, bool, ref bool)
Transforms query parameters json into collection of SortInfo
public static IEnumerable<SortInfo> TransformIndexQuerySortParams(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
TransformIndexQuerySortParams(string, IEnumerable<SortInfo>, ref bool)
Transforms query parameters json into collection of SortInfo
public static IEnumerable<SortInfo> TransformIndexQuerySortParams(string queryJson, IEnumerable<SortInfo> defaultValues, ref bool isDefault)
Parameters
queryJson
string- The json string
defaultValues
IEnumerable<SortInfo>- The default parameters to be returned if transform failed
isDefault
bool- The value indicating whether default parameters are used
Returns
- IEnumerable<SortInfo>
- collection of SortInfo