🔍 Code Extractor

class QueryRoutingInfo

Maturity: 44

A data class representing query routing information for SharePoint search operations, containing query state and search endpoints.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/search/query/routing_info.py
Lines:
6 - 15
Complexity:
simple

Purpose

QueryRoutingInfo is a client-side value object that encapsulates routing information for SharePoint search queries. It inherits from ClientValue and is used to store and manage the query state and a collection of search endpoints. This class is part of the Office 365 SharePoint search REST API integration, allowing applications to configure and track how search queries are routed across different endpoints.

Source Code

class QueryRoutingInfo(ClientValue):
    """This property contains the query routing info."""

    def __init__(self, query_state=None, search_endpoints=None):
        self.QueryState = query_state
        self.SearchEndpoints = ClientValueCollection(SearchEndpoints, search_endpoints)

    @property
    def entity_type_name(self):
        return "Microsoft.Office.Server.Search.REST.QueryRoutingInfo"

Parameters

Name Type Default Kind
bases ClientValue -

Parameter Details

query_state: Optional parameter representing the current state of the query. Can be None or a value that tracks the query's execution state. This is stored as the QueryState instance attribute.

search_endpoints: Optional parameter that can be a collection of SearchEndpoints objects or None. This is converted into a ClientValueCollection of SearchEndpoints and stored as the SearchEndpoints instance attribute. Represents the various endpoints where the search query can be routed.

Return Value

Instantiation returns a QueryRoutingInfo object with two attributes: QueryState (storing the query state) and SearchEndpoints (a ClientValueCollection containing SearchEndpoints objects). The entity_type_name property returns the string 'Microsoft.Office.Server.Search.REST.QueryRoutingInfo', which identifies the entity type in the SharePoint REST API.

Class Interface

Methods

__init__(self, query_state=None, search_endpoints=None)

Purpose: Initializes a new QueryRoutingInfo instance with optional query state and search endpoints

Parameters:

  • query_state: Optional query state value, defaults to None
  • search_endpoints: Optional collection of SearchEndpoints objects, defaults to None

Returns: None (constructor)

@property entity_type_name(self) -> str property

Purpose: Returns the SharePoint REST API entity type name for this class

Returns: String 'Microsoft.Office.Server.Search.REST.QueryRoutingInfo' representing the entity type in SharePoint

Attributes

Name Type Description Scope
QueryState Any Stores the current state of the query, can be None or any value representing query execution state instance
SearchEndpoints ClientValueCollection[SearchEndpoints] A collection of SearchEndpoints objects representing the endpoints where the search query can be routed instance

Dependencies

  • office365

Required Imports

from office365.runtime.client_value import ClientValue
from office365.runtime.client_value_collection import ClientValueCollection
from office365.sharepoint.search.endpoints import SearchEndpoints

Usage Example

from office365.sharepoint.search.query_routing_info import QueryRoutingInfo
from office365.sharepoint.search.endpoints import SearchEndpoints

# Create a QueryRoutingInfo instance with no parameters
routing_info = QueryRoutingInfo()

# Create with query state
routing_info = QueryRoutingInfo(query_state='active')

# Create with search endpoints
endpoints = [SearchEndpoints()]
routing_info = QueryRoutingInfo(query_state='pending', search_endpoints=endpoints)

# Access the entity type name
entity_type = routing_info.entity_type_name
print(entity_type)  # Output: Microsoft.Office.Server.Search.REST.QueryRoutingInfo

# Access query state and endpoints
print(routing_info.QueryState)
print(routing_info.SearchEndpoints)

Best Practices

  • This class is primarily a data container and should be instantiated with appropriate query state and search endpoints when needed for SharePoint search operations.
  • The SearchEndpoints attribute is automatically wrapped in a ClientValueCollection, so you can pass either a list of SearchEndpoints objects or None to the constructor.
  • The entity_type_name property is used internally by the Office 365 library for REST API serialization and should not be modified.
  • This class inherits from ClientValue, which means it's designed to be serialized and sent to SharePoint REST endpoints.
  • Both constructor parameters are optional, allowing flexible instantiation based on available information.
  • The QueryState and SearchEndpoints attributes use PascalCase naming convention, consistent with SharePoint API conventions.

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class QueryConfiguration 74.9% similar

    A data class representing query configuration for a SharePoint local farm, encapsulating query context, parameters, routing information, and search endpoints.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/search/query/configuration.py
  • class SearchQuery 67.4% similar

    Represents a search query object that encapsulates search terms and optional query templates for SharePoint/Office365 search operations.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/search/query.py
  • class SearchEndpoints 65.9% similar

    A class representing SharePoint search endpoints configuration, containing admin endpoint and query context for search operations.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/search/endpoints.py
  • class QueryProperty 64.6% similar

    A class representing a name-value pair for storing additional or custom properties for SharePoint search queries.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/search/query/property.py
  • class QueryCondition 63.9% similar

    QueryCondition is a data class that represents conditions for promoted search results in Microsoft Office Server Search REST API.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/search/query/condition.py
← Back to Browse