class documentation
class XapianSearch(BaseSearch):
Constructor: XapianSearch(*args, full_url, **kwargs)
A search for finding entries using a xapian database.
| Class Method | open |
Open the xapian fulltext index. |
| Class Method | open |
Open the xapian title index. |
| Method | __init__ |
The default constructor. |
| Method | close |
Perform any necessary cleanup. |
| Method | search |
Perform a search. |
| Method | search |
Perform a range-limited search. |
| Instance Variable | _database |
Undocumented |
| Instance Variable | _fd |
Undocumented |
| Instance Variable | _full |
Undocumented |
| Instance Variable | _queryparser |
Undocumented |
| Instance Variable | _stemmer |
Undocumented |
| Property | _offset |
Return the offset of the database in the ZIM file |
Inherited from BaseSearch:
| Instance Variable | zim |
the ZIM archive this search is for |
Open the xapian fulltext index.
| Parameters | |
*args:tuple | additional arguments that will be passed to XapianSearch.__init__ |
**kwargs:dict | additional keyword arguments that will be passed to XapianSearch.__init__ |
| Returns | |
XapianSearch | a xapian search using the fulltext index of a ZIM |
| Raises | |
pyzim.exceptions.ZimFeatureMissing | when the ZIM files does not include a xapian title index |
pyzim.exceptions.MissingDependency | when the xapian library could not be imported |
Open the xapian title index.
| Parameters | |
*args:tuple | additional arguments that will be passed to XapianSearch.__init__ |
**kwargs:dict | additional keyword arguments that will be passed to XapianSearch.__init__ |
| Returns | |
XapianSearch | a xapian search using the title index of a ZIM |
| Raises | |
pyzim.exceptions.ZimFeatureMissing | when the ZIM files does not include a xapian title index |
pyzim.exceptions.MissingDependency | when the xapian library could not be imported |
overrides
pyzim.search.BaseSearch.__init__The default constructor.
All arguments that are not specific for this method will be passed to the superclass.
| Parameters | |
| *args | Undocumented |
fullstr | full URL of xapian database to use |
| **kwargs | Undocumented |
| Raises | |
pyzim.exceptions.ZimFeatureMissing | when the ZIM files does not include a xapian index at the specified full url |
pyzim.exceptions.MissingDependency | when the xapian library could not be imported |
overrides
pyzim.search.BaseSearch.closePerform any necessary cleanup.
This should be called before the instance is dismissed.
overrides
pyzim.search.BaseSearch.searchPerform a search.
| Parameters | |
term:str | term to search for |
| Returns | |
SearchResultSet | an object containing the search results |
overrides
pyzim.search.BaseSearch.search_in_rangePerform a range-limited search.
This function is primarily a helper function used by SearchResultSet to iteratively fetch new results, but it can still be used independently. Just beware of the different return type.
| Parameters | |
term:str | term to search for |
start:int | start (1-based index) of the results to find |
n:int | number of results to fetch |
| Returns | |
list of SearchResult | an object containing the search results |