Telepath API
- class synmods.search.service.SearchApi
Bases:
CellApi
,StormSvc
A Telepath API for the Search service.
- async addFileWork(iden: str) None
Add a new file to be indexed across all layers.
- Parameters:
iden (str) – The iden of the file:bytes node
- async addIndex(ftyp: str, fnam: str, enc: str, priority=50) None
Add a new index to the service.
- Parameters:
ftyp (str) – The field type to index (e.g. form, formprop)
fnam (str) – The field name to index (e.g. “inet:asnet4”, “media:news,title”)
enc (str) – The encoder name to use for indexing
priority (int) – Priority for the new index (higher is more important)
- async addToknRoot(tokn: str, root: str) str | None
- async delIndex(ftyp: str, fnam: str) None
Delete an index on all layers.
- Parameters:
ftyp (str or None) – The field type to index (e.g. form, formprop)
fnam (str or None) – The field name to index (e.g. “inet:asnet4”, “media:news,title”)
- async delToknRoot(tokn: str) bool
- async getDefaultPropInfo() Dict[str, Dict[str, Any]]
- async getIndxOffs() int
Get the current offset the service has indexed to.
- Returns:
The index offset
- Return type:
int
- async getLayersInfo() Dict[str, Dict[str, int]]
Get information about the indexed layers.
- Returns:
Map of Layer iden to an info dict.
- Return type:
dict
- async getNode(layrs: Sequence[str] | None, iden: str, ftyp: str | None, fnam: str | None) Tuple[str, List[Dict[str, Any]]] | None
- async getSearchDataModel() Dict
Get the datamodel currently loaded in the Search service.
- Returns:
The datamodel dictionary.
- Return type:
dict
- async getStatus(all_fields: bool = False) List[Dict[str, Any]]
Get the current status of field indexing.
- Parameters:
all_fields (bool) – If False, only return fields being actively indexed.
- Returns:
List of field status dictionaries
- Return type:
list
- async getToknRoot(tokn: str) str | None
- async getToknRoots(size: int | None = None) AsyncIterator[Tuple[str, str]]
- async isIndexed(ftyp: str, fnam: str) bool
Determine if a field is indexed.
- Parameters:
ftyp (str or None) – The field type to index (e.g. form, formprop)
fnam (str or None) – The field name to index (e.g. “inet:asnet4”, “media:news,title”)
- async iterNodes(layrs: Sequence[str] | None, ftyp: str | None, fnam: str | None, size: int | None = 100) AsyncIterator[Tuple[str, List[Dict[str, Any]]]]
- async query(layrs: Sequence[str], ftyp: str | Sequence[str] | None, fnam: str | Sequence[str] | None, valu: str, reqfield: bool = True, limit: int | None = None) AsyncIterator[Tuple[str, Dict[str, str]]]
Query the index service.
- Parameters:
layrs (list) – List of layer idens to query
ftyp (Optional[Union[str, List[str]]]) – The field type to query (e.g. form, formprop)
fnam (Optional[Union[str, List[str]]]) – The field name to query (e.g. “inet:asnet4”, “media:news,title”)
valu – The valu to query service for
reqfield (bool) – If False, do not raise an exception for a field that is not indexed.
limit (int or None) – If specified, yield up to limit items
- Yields:
tuple – Matching node iden and query info
- async reindex(fullreset=False) None
Execute a reindex operation for the entire service.
- Parameters:
fullreset (bool) – Do not re-populate index from existing fields (i.e. service is returned to fresh state)