base_searcher#

aws_resource_search.base_searcher.preprocess_query(query: Optional[str]) str[source]#

Preprocess query, automatically add fuzzy search term if applicable.

class aws_resource_search.base_searcher.BaseSearcher(service: str, method: str, is_paginator: bool, default_boto_kwargs: Optional[dict], result_path: ResultPath, doc_class: Type[T_ARS_RESOURCE_DOCUMENT], resource_type: str, fields: List[Union[StoredField, IdField, IdListField, KeywordField, TextField, NumericField, DatetimeField, BooleanField, NgramField, NgramWordsField]], cache_expire: int, more_cache_key: Optional[Callable[[Dict[str, Any]], List[str]]], bsm: Optional[BotoSesManager] = None)[source]#

todo: docstring

Parameters:
  • service

  • method

  • is_paginator

  • default_boto_kwargs

  • result_path

  • doc_class

  • resource_type

  • fields

  • cache_expire

  • more_cache_key

  • bsm

search(query: str = '*', limit: int = 50, boto_kwargs: Optional[dict] = None, refresh_data: bool = False, simple_response: bool = True, verbose: bool = False, bsm: Optional[BotoSesManager] = None) Union[T_Result, List[T_ARS_RESOURCE_DOCUMENT]][source]#

Search the dataset.

Parameters:
  • query – query string

  • limit – the max number of results to return

  • boto_kwargs – additional boto3 keyword arguments

  • refresh_data – force to refresh the data

  • simple_response – if True, then return a list of T_ARS_RESOURCE_DOCUMENT objects, otherwise return the elasticsearch liked result.

  • verbose – whether to print the log

  • bsm – you can explicitly use a BotoSesManager object to override the default one you defined when creating the aws_resource_search.base_searcher.BaseSearcher` object.