class Pipeline: (source)
lunr.Pipelines maintain a list of functions to be applied to all tokens in documents entering the search index and queries ran agains the index.
Class Method | load |
Loads a previously serialised pipeline. |
Class Method | register |
Register a function with the pipeline. |
Method | __init__ |
Undocumented |
Method | __len__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | add |
Adds new functions to the end of the pipeline. |
Method | after |
Adds a single function after a function that already exists in the pipeline. |
Method | before |
Adds a single function before a function that already exists in the pipeline. |
Method | remove |
Removes a function from the pipeline. |
Method | reset |
Undocumented |
Method | run |
Runs the current list of functions that make up the pipeline against the passed tokens. |
Method | run |
Convenience method for passing a string through a pipeline and getting strings out. This method takes care of wrapping the passed string in a token and mapping the resulting tokens back to strings. |
Method | serialize |
Undocumented |
Method | skip |
Make the pipeline skip the function based on field name we're processing. |
Method | warn |
Undocumented |
Class Variable | registered |
Undocumented |
Instance Variable | _skip |
Undocumented |
Instance Variable | _stack |
Undocumented |
Adds new functions to the end of the pipeline. Functions must accept three arguments: - Token: A lunr.Token object which will be updated - i: The index of the token in the set - tokens: A list of tokens representing the set
Runs the current list of functions that make up the pipeline against the passed tokens. :param tokens: The tokens to process. :param field_name: The name of the field these tokens belongs to, can be ommited. Used to skip some functions based on field names.
Convenience method for passing a string through a pipeline and getting strings out. This method takes care of wrapping the passed string in a token and mapping the resulting tokens back to strings. .. note:: This ignores the skipped functions since we can't access field names from this context.