class QueryConfiguration
A data class representing query configuration for a SharePoint local farm, encapsulating query context, parameters, routing information, and search endpoints.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/search/query/configuration.py
10 - 34
simple
Purpose
This class serves as a response object for the SharePoint REST API call to get query configuration (section 3.1.5.18.2.1.6). It aggregates four key components of search query configuration: QueryContext for query context information, ExpandedQueryParameters for detailed query parameters, QueryRoutingInfo for routing details, and SearchEndpoints for search endpoint information. It inherits from ClientValue, making it suitable for serialization and transmission in SharePoint REST API communications.
Source Code
class QueryConfiguration(ClientValue):
"""This object contains the query configuration for the local farm and is the response
to the REST call get query configuration (section 3.1.5.18.2.1.6)."""
def __init__(
self,
query_context=QueryContext(),
query_parameters=ExpandedQueryParameters(),
query_routing_info=QueryRoutingInfo(),
search_endpoints=SearchEndpoints(),
):
"""
:param QueryContext query_context: This property contains the query context.
:param ExpandedQueryParameters query_parameters: This property contains the expanded query parameters.
:param QueryRoutingInfo query_routing_info: This property contains the query routing info.
:param SearchEndpoints search_endpoints: This property contains the search endpoints.
"""
self.QueryContext = query_context
self.QueryParameters = query_parameters
self.QueryRoutingInfo = query_routing_info
self.SearchEndpoints = search_endpoints
@property
def entity_type_name(self):
return "Microsoft.Office.Server.Search.REST.QueryConfiguration"
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
ClientValue | - |
Parameter Details
query_context: A QueryContext object containing the query context information. Defaults to an empty QueryContext() instance if not provided. This represents the contextual information about the query execution environment.
query_parameters: An ExpandedQueryParameters object containing the expanded query parameters. Defaults to an empty ExpandedQueryParameters() instance if not provided. This holds detailed parameters that control query behavior and filtering.
query_routing_info: A QueryRoutingInfo object containing the query routing information. Defaults to an empty QueryRoutingInfo() instance if not provided. This specifies how queries should be routed within the SharePoint farm.
search_endpoints: A SearchEndpoints object containing the search endpoints configuration. Defaults to an empty SearchEndpoints() instance if not provided. This defines the available search endpoints for query execution.
Return Value
Instantiation returns a QueryConfiguration object with four instance attributes (QueryContext, QueryParameters, QueryRoutingInfo, SearchEndpoints) populated with the provided or default values. The entity_type_name property returns the string 'Microsoft.Office.Server.Search.REST.QueryConfiguration', which identifies the object type in SharePoint REST API responses.
Class Interface
Methods
__init__(self, query_context=QueryContext(), query_parameters=ExpandedQueryParameters(), query_routing_info=QueryRoutingInfo(), search_endpoints=SearchEndpoints())
Purpose: Initializes a QueryConfiguration instance with query context, parameters, routing info, and search endpoints
Parameters:
query_context: QueryContext object containing query context information (defaults to empty QueryContext())query_parameters: ExpandedQueryParameters object containing expanded query parameters (defaults to empty ExpandedQueryParameters())query_routing_info: QueryRoutingInfo object containing query routing information (defaults to empty QueryRoutingInfo())search_endpoints: SearchEndpoints object containing search endpoints configuration (defaults to empty SearchEndpoints())
Returns: None (constructor)
@property entity_type_name(self) -> str
property
Purpose: Returns the SharePoint entity type name identifier for this query configuration object
Returns: String 'Microsoft.Office.Server.Search.REST.QueryConfiguration' representing the SharePoint entity type
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
QueryContext |
QueryContext | Stores the query context information for the search query configuration | instance |
QueryParameters |
ExpandedQueryParameters | Stores the expanded query parameters that control query behavior and filtering | instance |
QueryRoutingInfo |
QueryRoutingInfo | Stores the query routing information specifying how queries are routed within the SharePoint farm | instance |
SearchEndpoints |
SearchEndpoints | Stores the search endpoints configuration defining available search endpoints | instance |
Dependencies
office365
Required Imports
from office365.runtime.client_value import ClientValue
from office365.sharepoint.search.endpoints import SearchEndpoints
from office365.sharepoint.search.query.context import QueryContext
from office365.sharepoint.search.query.expanded_parameters import ExpandedQueryParameters
from office365.sharepoint.search.query.routing_info import QueryRoutingInfo
Usage Example
from office365.sharepoint.search.query.configuration import QueryConfiguration
from office365.sharepoint.search.query.context import QueryContext
from office365.sharepoint.search.query.expanded_parameters import ExpandedQueryParameters
from office365.sharepoint.search.query.routing_info import QueryRoutingInfo
from office365.sharepoint.search.endpoints import SearchEndpoints
# Create with default values
config = QueryConfiguration()
# Access the entity type name
entity_type = config.entity_type_name
print(entity_type) # Output: Microsoft.Office.Server.Search.REST.QueryConfiguration
# Create with custom components
custom_context = QueryContext()
custom_params = ExpandedQueryParameters()
custom_routing = QueryRoutingInfo()
custom_endpoints = SearchEndpoints()
config = QueryConfiguration(
query_context=custom_context,
query_parameters=custom_params,
query_routing_info=custom_routing,
search_endpoints=custom_endpoints
)
# Access instance attributes
context = config.QueryContext
params = config.QueryParameters
routing = config.QueryRoutingInfo
endpoints = config.SearchEndpoints
Best Practices
- This class is primarily a data container and should be instantiated with appropriate QueryContext, ExpandedQueryParameters, QueryRoutingInfo, and SearchEndpoints objects
- The class is typically used as a response object from SharePoint REST API calls rather than being manually constructed in most scenarios
- All constructor parameters have default values (empty instances), so the class can be instantiated without arguments for testing or placeholder purposes
- The entity_type_name property should not be modified as it represents the fixed SharePoint entity type identifier
- Instance attributes use PascalCase naming (QueryContext, QueryParameters, etc.) following SharePoint API conventions
- This class inherits from ClientValue, which likely provides serialization/deserialization capabilities for REST API communication
- The class is immutable after construction - there are no setter methods, so create a new instance if different configuration is needed
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class QueryRoutingInfo 74.9% similar
-
class SearchEndpoints 74.5% similar
-
class QueryContext 72.9% similar
-
class SearchQuery 71.8% similar
-
class QueryCondition 68.7% similar