class RefinerEntry
RefinerEntry is a data class representing a single refinement entry in Microsoft Office Server Search REST API, containing a refinement name and its associated count.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/search/refiner/entry.py
4 - 15
simple
Purpose
This class serves as a data transfer object (DTO) for SharePoint/Office 365 search refinement results. It encapsulates information about search refiners (facets), which are used to filter and narrow down search results. Each RefinerEntry represents one possible refinement option with its name and the count of items matching that refinement. This is commonly used in search UI to display filter options with result counts.
Source Code
class RefinerEntry(ClientValue):
def __init__(self, refinement_count=None, refinement_name=None):
"""
:param int refinement_count:
:param str refinement_name:
"""
self.RefinementCount = refinement_count
self.RefinementName = refinement_name
@property
def entity_type_name(self):
return "Microsoft.Office.Server.Search.REST.RefinerEntry"
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
ClientValue | - |
Parameter Details
refinement_count: An integer representing the number of search results that match this particular refinement. This count helps users understand how many items will be returned if they apply this refinement filter. Can be None if count is not available.
refinement_name: A string representing the name or value of the refinement option. This is the actual filter value that can be applied to narrow search results (e.g., 'PDF' for file type, '2023' for year). Can be None if name is not provided.
Return Value
Instantiation returns a RefinerEntry object that inherits from ClientValue. The object contains two instance attributes (RefinementCount and RefinementName) and provides an entity_type_name property that returns the Microsoft Office Server Search REST API type identifier string.
Class Interface
Methods
__init__(self, refinement_count=None, refinement_name=None)
Purpose: Initializes a new RefinerEntry instance with optional refinement count and name
Parameters:
refinement_count: Optional integer representing the count of items matching this refinementrefinement_name: Optional string representing the name/value of the refinement option
Returns: None (constructor)
@property entity_type_name(self) -> str
property
Purpose: Returns the Microsoft Office Server Search REST API entity type identifier for this class
Returns: String constant 'Microsoft.Office.Server.Search.REST.RefinerEntry' identifying the entity type in the Office 365 REST API
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
RefinementCount |
int or None | The number of search results that match this refinement option. Used to show users how many items will be filtered when applying this refinement. | instance |
RefinementName |
str or None | The name or value of the refinement option. This is the actual filter value that represents a facet in search results (e.g., file type, author, date range). | instance |
Dependencies
office365
Required Imports
from office365.runtime.client_value import ClientValue
Usage Example
from office365.runtime.client_value import ClientValue
# Create a RefinerEntry for a file type refinement
refiner = RefinerEntry(
refinement_count=42,
refinement_name='PDF'
)
# Access the refinement data
print(f"Refinement: {refiner.RefinementName}")
print(f"Count: {refiner.RefinementCount}")
print(f"Entity Type: {refiner.entity_type_name}")
# Create with no initial values
empty_refiner = RefinerEntry()
empty_refiner.RefinementName = 'Word Document'
empty_refiner.RefinementCount = 15
Best Practices
- This class is primarily used as a data container and should not contain business logic
- Instances are typically created by the Office 365 SDK when parsing search results, rather than manually by developers
- The class inherits from ClientValue, which provides serialization/deserialization capabilities for Office 365 REST API communication
- RefinementCount and RefinementName are public attributes and can be modified after instantiation, though this is typically not necessary
- The entity_type_name property should not be overridden as it identifies the object type for the Microsoft Office Server Search REST API
- When using in search refinement scenarios, check if RefinementCount is None or 0 before displaying to users
- This class is immutable in practice - create new instances rather than modifying existing ones for thread safety
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class Refiner 86.8% similar
-
class RefinementResults 74.2% similar
-
class SPResourceEntry 56.0% similar
-
class ReorderingRuleCollection 54.4% similar
-
class MessageEntry 54.3% similar