|
.oO SearXNG Developer Documentation Oo.
|
Functions | |
| init (engine_settings) | |
| sqlite_cursor () | |
| EngineResults | search (query, params) |
Variables | |
| str | engine_type = "offline" |
| str | database = "" |
| str | query_str = "" |
| t | result_type = "KeyValue" |
| int | limit = 10 |
| bool | paging = True |
SQLite is a small, fast and reliable SQL database engine. It does not require
any extra dependency.
Configuration
=============
The engine has the following (additional) settings:
- :py:obj:`result_type`
Example
=======
.. _MediathekView: https://mediathekview.de/
To demonstrate the power of database engines, here is a more complex example
which reads from a MediathekView_ (DE) movie database. For this example of the
SQLite engine download the database:
- https://liste.mediathekview.de/filmliste-v2.db.bz2
and unpack into ``searx/data/filmliste-v2.db``. To search the database use e.g
Query to test: ``!mediathekview concert``
.. code:: yaml
- name: mediathekview
engine: sqlite
shortcut: mediathekview
categories: [general, videos]
result_type: MainResult
database: searx/data/filmliste-v2.db
query_str: >-
SELECT title || ' (' || time(duration, 'unixepoch') || ')' AS title,
COALESCE( NULLIF(url_video_hd,''), NULLIF(url_video_sd,''), url_video) AS url,
description AS content
FROM film
WHERE title LIKE :wildcard OR description LIKE :wildcard
ORDER BY duration DESC
Implementations
===============
| searx.engines.sqlite.init | ( | engine_settings | ) |
Definition at line 69 of file sqlite.py.
| EngineResults searx.engines.sqlite.search | ( | query, | |
| params ) |
Definition at line 96 of file sqlite.py.
References sqlite_cursor().
| searx.engines.sqlite.sqlite_cursor | ( | ) |
Implements a :py:obj:`Context Manager <contextlib.contextmanager>` for a :py:obj:`sqlite3.Cursor`. Open database in read only mode: if the database doesn't exist. The default mode creates an empty file on the file system. See: * https://docs.python.org/3/library/sqlite3.html#sqlite3.connect * https://www.sqlite.org/uri.html
Definition at line 78 of file sqlite.py.
Referenced by search().