FullTextSearch API
Frappe Wrapper for Whoosh
update\_index\_by\_name(self, doc\_name)
Wraps update\_index
method, gets the document from name and updates the index. This function changes the current user and should only be run as administrator or in a background job.
Args:
- self (object): FullTextSearch Instance
- doc_name (str): name of the document to be updated
remove\_document\_from\_index(self, doc\_name)
Remove document from search index
Args:
- self (object): FullTextSearch Instance
- doc_name (str): name of the document to be removed
update\_index(self, document)
Update search index for a document
Args:
- self (object): FullTextSearch Instance
- document (_dict): A dictionary with title, path and content
build\_index(self)
Build index for all parsed documents
search(self, text, scope=None, limit=20)
Search from the current index
Args:
- text (str): String to search for
- scope (str, optional): Scope to limit the search. Defaults to None.
- limit (int, optional): Limit number of search results. Defaults to 20.
Returns:
- [list(_dict)]: Search results