Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sdk/search/azure-search-documents/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
- Added properties to `SearchIndexerDataSourceConnection`: `identity`, `encryption_key`.
- Added `select` property to the following `SearchIndexClient` operations: `get_synonym_maps`, `list_indexes`.
- Added `select` property to the following `SearchIndexersClient` operations: `get_data_source_connections`, `get_indexers`, `get_skillsets`.
- Added operations to `SearchIndexerClient`: `reset_skills`, `reset_documents`.
- Added model: `DocumentKeysOrIds`

### Other Changes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

if TYPE_CHECKING:
# pylint:disable=unused-import,ungrouped-imports
from ._generated.models import SearchIndexer, SearchIndexerStatus
from ._generated.models import SearchIndexer, SearchIndexerStatus, DocumentKeysOrIds
from typing import Any, Optional, Sequence, Union
from azure.core.credentials import TokenCredential

Expand Down Expand Up @@ -285,6 +285,30 @@ def reset_indexer(self, name, **kwargs):
kwargs["headers"] = self._merge_client_headers(kwargs.get("headers"))
self._client.indexers.reset(name, **kwargs)

@distributed_trace
def reset_documents(self, indexer, keys_or_ids, **kwargs):
# type: (Union[str, SearchIndexer], DocumentKeysOrIds, **Any) -> None
"""Resets specific documents in the datasource to be selectively re-ingested by the indexer.

:param indexer: The indexer to reset documents for.
:type indexer: str or ~azure.search.documents.indexes.models.SearchIndexer
:param keys_or_ids:
:type keys_or_ids: ~azure.search.documents.indexes.models.DocumentKeysOrIds
:return: None, or the result of cls(response)
:keyword overwrite: If false, keys or ids will be appended to existing ones. If true, only the
keys or ids in this payload will be queued to be re-ingested. The default is false.
:paramtype overwrite: bool
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
kwargs["headers"] = self._merge_client_headers(kwargs.get("headers"))
kwargs["keys_or_ids"] = keys_or_ids
try:
name = indexer.name
except AttributeError:
name = indexer
return self._client.indexers.reset_docs(name, **kwargs)

@distributed_trace
def get_indexer_status(self, name, **kwargs):
# type: (str, **Any) -> SearchIndexerStatus
Expand Down Expand Up @@ -547,8 +571,8 @@ def delete_skillset(self, skillset, **kwargs):
the SearchIndexerSkillset model must be provided instead of the name. It is enough to provide
the name of the skillset to delete unconditionally

:param name: The SearchIndexerSkillset to delete
:type name: str or ~azure.search.documents.indexes.models.SearchIndexerSkillset
:param skillset: The SearchIndexerSkillset to delete
:type skillset: str or ~azure.search.documents.indexes.models.SearchIndexerSkillset
:keyword match_condition: The match condition to use upon the etag
:type match_condition: ~azure.core.MatchConditions

Expand Down Expand Up @@ -635,6 +659,26 @@ def create_or_update_skillset(self, skillset, **kwargs):
)
return SearchIndexerSkillset._from_generated(result) # pylint:disable=protected-access

@distributed_trace
def reset_skills(self, skillset, skill_names, **kwargs):
# type: (Union[str, SearchIndexerSkillset], List[str], **Any) -> None
"""Reset an existing skillset in a search service.

:param skillset: The SearchIndexerSkillset to reset
:type skillset: str or ~azure.search.documents.indexes.models.SearchIndexerSkillset
:param skill_names: the names of skills to be reset.
:type skill_names: list[str]
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
kwargs["headers"] = self._merge_client_headers(kwargs.get("headers"))
try:
name = skillset.name
except AttributeError:
name = skillset
return self._client.skillsets.reset_skills(name, skill_names, **kwargs)

def _validate_skillset(skillset):
"""Validates any multi-version skills in the skillset to verify that unsupported
parameters are not supplied by the user.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

if TYPE_CHECKING:
# pylint:disable=unused-import,ungrouped-imports
from .._generated.models import SearchIndexer, SearchIndexerStatus
from .._generated.models import SearchIndexer, SearchIndexerStatus, DocumentKeysOrIds
from typing import Any, Optional, Sequence
from azure.core.credentials_async import AsyncTokenCredential

Expand Down Expand Up @@ -278,6 +278,31 @@ async def reset_indexer(self, name, **kwargs):
kwargs["headers"] = self._merge_client_headers(kwargs.get("headers"))
await self._client.indexers.reset(name, **kwargs)

@distributed_trace_async
async def reset_documents(self, indexer, keys_or_ids, **kwargs):
# type: (Union[str, SearchIndexer], DocumentKeysOrIds, **Any) -> None
"""Resets specific documents in the datasource to be selectively re-ingested by the indexer.

:param indexer: The indexer to reset documents for.
:type indexer: str or ~azure.search.documents.indexes.models.SearchIndexer
:param keys_or_ids:
:type keys_or_ids: ~azure.search.documents.indexes.models.DocumentKeysOrIds
:return: None, or the result of cls(response)
:keyword overwrite: If false, keys or ids will be appended to existing ones. If true, only the
keys or ids in this payload will be queued to be re-ingested. The default is false.
:paramtype overwrite: bool
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
kwargs["headers"] = self._merge_client_headers(kwargs.get("headers"))
kwargs["keys_or_ids"] = keys_or_ids
try:
name = indexer.name
except AttributeError:
name = indexer
result = await self._client.indexers.reset_docs(name, **kwargs)
return result

@distributed_trace_async
async def get_indexer_status(self, name, **kwargs):
# type: (str, **Any) -> SearchIndexerStatus
Expand Down Expand Up @@ -535,8 +560,8 @@ async def delete_skillset(self, skillset, **kwargs):
the SearchIndexerSkillset model must be provided instead of the name. It is enough to provide
the name of the skillset to delete unconditionally

:param name: The SearchIndexerSkillset to delete
:type name: str or ~azure.search.documents.indexes.models.SearchIndexerSkillset
:param skillset: The SearchIndexerSkillset to delete
:type skillset: str or ~azure.search.documents.indexes.models.SearchIndexerSkillset
:keyword match_condition: The match condition to use upon the etag
:type match_condition: ~azure.core.MatchConditions

Expand Down Expand Up @@ -619,3 +644,24 @@ async def create_or_update_skillset(self, skillset, **kwargs):
**kwargs
)
return SearchIndexerSkillset._from_generated(result) # pylint:disable=protected-access

@distributed_trace_async
async def reset_skills(self, skillset, skill_names, **kwargs):
# type: (Union[str, SearchIndexerSkillset], List[str], **Any) -> None
"""Reset an existing skillset in a search service.

:param skillset: The SearchIndexerSkillset to reset
:type skillset: str or ~azure.search.documents.indexes.models.SearchIndexerSkillset
:param skill_names: the names of skills to be reset.
:type skill_names: list[str]
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
kwargs["headers"] = self._merge_client_headers(kwargs.get("headers"))
try:
name = skillset.name
except AttributeError:
name = skillset
result = await self._client.skillsets.reset_skills(name, skill_names, **kwargs)
return result
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
DistanceScoringFunction,
DistanceScoringParameters,
DocumentExtractionSkill,
DocumentKeysOrIds,
EdgeNGramTokenFilter,
EdgeNGramTokenizer,
EdgeNGramTokenFilterSide,
Expand Down Expand Up @@ -199,6 +200,7 @@
"DistanceScoringFunction",
"DistanceScoringParameters",
"DocumentExtractionSkill",
"DocumentKeysOrIds",
"EdgeNGramTokenFilter",
"EdgeNGramTokenizer",
"ElisionTokenFilter",
Expand Down
Loading