🔍 Code Extractor

class QueryAutoCompletionResults

Maturity: 34

A class representing the results of a SharePoint query auto-completion operation, containing execution metrics, correlation information, and a collection of query suggestions.

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

Purpose

This class encapsulates the response data from SharePoint's GetQueryCompletions operation (section 3.1.4.25.2.1). It serves as a data transfer object that holds query auto-completion suggestions along with metadata about the request execution, including timing information and correlation tracking. It inherits from ClientValue, making it compatible with SharePoint's client-side object model for serialization and deserialization.

Source Code

class QueryAutoCompletionResults(ClientValue):
    def __init__(self, core_execution_time_ms=None, correlation_id=None, queries=None):
        """The complex type QueryAutoCompletionResults represent the result of the operation GetQueryCompletions
        as specified in section 3.1.4.25.2.1.

        :param int core_execution_time_ms:  This element represent the time spent in the protocol server retrieving
             the result.
        :param str correlation_id: This element represent the correlation identification of the request.
        :param list[QueryAutoCompletion] queries: This complex type represent the list of QueryAutoCompletion as
            specified in section 3.1.4.25.3.4 for the Query
        """
        self.CoreExecutionTimeMs = core_execution_time_ms
        self.CorrelationId = correlation_id
        self.Queries = ClientValueCollection(QueryAutoCompletion, queries)

    @property
    def entity_type_name(self):
        return "Microsoft.SharePoint.Client.Search.Query.QueryAutoCompletionResults"

Parameters

Name Type Default Kind
bases ClientValue -

Parameter Details

core_execution_time_ms: Optional integer representing the time in milliseconds spent by the protocol server retrieving the auto-completion results. Used for performance monitoring and diagnostics. Can be None if timing information is not available.

correlation_id: Optional string representing the correlation identification of the request. Used for tracking and debugging requests across distributed systems. Can be None if correlation tracking is not enabled.

queries: Optional list of QueryAutoCompletion objects representing the actual query suggestions returned by the auto-completion service. Each item contains a suggested query string and related metadata. Can be None or an empty list if no suggestions are available.

Return Value

Instantiation returns a QueryAutoCompletionResults object with three instance attributes: CoreExecutionTimeMs (int or None), CorrelationId (str or None), and Queries (ClientValueCollection containing QueryAutoCompletion objects). The entity_type_name property returns the string 'Microsoft.SharePoint.Client.Search.Query.QueryAutoCompletionResults' for SharePoint type identification.

Class Interface

Methods

__init__(self, core_execution_time_ms=None, correlation_id=None, queries=None)

Purpose: Initializes a new QueryAutoCompletionResults instance with execution metrics and query suggestions

Parameters:

  • core_execution_time_ms: Optional integer for server execution time in milliseconds
  • correlation_id: Optional string for request correlation tracking
  • queries: Optional list of QueryAutoCompletion objects representing suggestions

Returns: None (constructor)

@property entity_type_name(self) -> str property

Purpose: Returns the SharePoint entity type name for this class, used for protocol serialization and type identification

Returns: String 'Microsoft.SharePoint.Client.Search.Query.QueryAutoCompletionResults' representing the SharePoint type identifier

Attributes

Name Type Description Scope
CoreExecutionTimeMs int or None Time in milliseconds spent by the protocol server retrieving the auto-completion results instance
CorrelationId str or None Correlation identification string for tracking the request across systems instance
Queries ClientValueCollection[QueryAutoCompletion] Collection of QueryAutoCompletion objects representing the query suggestions returned by the auto-completion service instance

Dependencies

  • office365

Required Imports

from office365.runtime.client_value import ClientValue
from office365.runtime.client_value_collection import ClientValueCollection
from office365.sharepoint.search.query.auto_completion import QueryAutoCompletion

Usage Example

from office365.sharepoint.search.query.auto_completion_results import QueryAutoCompletionResults
from office365.sharepoint.search.query.auto_completion import QueryAutoCompletion

# Create query suggestions
suggestion1 = QueryAutoCompletion()
suggestion2 = QueryAutoCompletion()

# Instantiate results object
results = QueryAutoCompletionResults(
    core_execution_time_ms=150,
    correlation_id='abc-123-def-456',
    queries=[suggestion1, suggestion2]
)

# Access attributes
print(f"Execution time: {results.CoreExecutionTimeMs}ms")
print(f"Correlation ID: {results.CorrelationId}")
print(f"Number of suggestions: {len(results.Queries)}")
print(f"Entity type: {results.entity_type_name}")

# Iterate through suggestions
for query in results.Queries:
    print(f"Suggestion: {query}")

Best Practices

  • This class is typically instantiated by the SharePoint client library when processing GetQueryCompletions responses, not manually by end users
  • The Queries attribute is wrapped in a ClientValueCollection for proper serialization/deserialization with SharePoint's protocol
  • Always check if CoreExecutionTimeMs and CorrelationId are None before using them, as they are optional
  • The entity_type_name property is used internally by the SharePoint client library for type resolution and should not be modified
  • This is an immutable data container - attributes should be set during initialization and not modified afterward
  • Use the Queries collection to iterate through auto-completion suggestions returned from SharePoint search

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class QueryAutoCompletion 91.1% similar

    A class representing query auto-completion results from SharePoint Search, containing matched results from a specific source with associated query text and relevance score.

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

    A data class representing a single autocomplete match result from a SharePoint search query, containing alternation text and a key identifier.

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

    A container class for SharePoint search query suggestions, including people names, personal results, popular results, and query suggestions.

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

    A client value class representing a query suggestion query for SharePoint search operations.

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

    A data class representing a personal search result suggestion from SharePoint Search, containing metadata about suggested results including title, URL, and best bet status.

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