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.generate_index_from_docs(input_documents_to_index, index_ref_id, index_configuration, index_fieds_definition)#

Build search index from input documents.

Paramètres:
  • input_documents_to_index (dict) – documents to index

  • index_ref_id (str) – field to use as index primary key

  • index_configuration (dict) – index configuration (language, etc.)

  • index_fieds_definition (List[dict]) – fields settings (boost, etc.)

Renvoie:

lunr Index

Type renvoyé:

Index

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é:

argparse.ArgumentParser

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:

  1. Check if the local index file exists and is up to date

  2. If not:
    1. Download the website contents listing from remote

    2. Generate a local index from the contents listing

  3. Load the local index

  4. Perform the search

Paramètres:

args (argparse.Namespace) – arguments passed to the subcommand