geotribu_cli.search.search_content module#
- geotribu_cli.search.search_content.filter_content_listing(json_filepath)#
Filtering out irrelevant docs from content listing to reduce number of documents to index.
- Paramètres:
json_filepath (Path) – path to the input JSON file
- Renvoie:
filtered object
- Type renvoyé:
filter
- geotribu_cli.search.search_content.format_output_result(result, search_term=None, format_type=None, count=5, search_filter_dates=None, search_filter_type=None)#
Format result according to output option.
- Paramètres:
search_term (str, optional) – term used for search. Defaults to None.
format_type (str, optional) – format output option. Defaults to None.
count (int, optional) – default number of results to display. Defaults to 5.
search_filter_dates (
tuple
) – dates used to filter search. Defaults to None.search_filter_type (
str
) – type used to filter search. Defaults to None.
- Renvoie:
formatted result ready to print
- Type renvoyé:
- geotribu_cli.search.search_content.generate_index_from_docs(input_documents_to_index, index_ref_id, index_configuration, index_fieds_definition)#
Build search index from input documents.
- geotribu_cli.search.search_content.parser_search_content(subparser)#
Set the argument parser for search-content subcommand.
- Paramètres:
subparser (argparse.ArgumentParser) – parser to set up
- Renvoie:
parser ready to use
- Type renvoyé:
- geotribu_cli.search.search_content.run(args)#
Run the sub command logic.
There are 2 files involved (names can vary):
site_content_listing.json: the downloaded file from the website which is just a listing of contents
site_search_index.json (= args.local_index_file): the file with the indexed contents with lunr built locally from the listing file.
Process:
Check if the local index file exists and is up to date
- If not:
Download the website contents listing from remote
Generate a local index from the contents listing
Load the local index
Perform the search
- Paramètres:
args (argparse.Namespace) – arguments passed to the subcommand