From 054edd8a41195b98a6ac1cb31c5564f6f2e71f33 Mon Sep 17 00:00:00 2001 From: j Date: Tue, 12 Feb 2019 13:36:45 +0530 Subject: [PATCH] linux placeholder --- oml/fulltext.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/oml/fulltext.py b/oml/fulltext.py index d1cd5ee..67ca6bf 100644 --- a/oml/fulltext.py +++ b/oml/fulltext.py @@ -32,6 +32,18 @@ def find_fulltext_windows(query): books = [b.split(':')[0] for b in books] return get_ids(books, prefix) +def find_fulltext_linux(query): + prefix = get_prefix() + cmd = [ + 'tracker', + 'sparql', + '-q', + "SELECT nie:url(?f) WHERE { ?f fts:match '%s' FILTER (tracker:uri-is-descendant ('file://%s', nie:url (?u))) }" % (query, prefix) + ] + books = subprocess.check_output(cmd).decode().strip().split('\n') + books = [b.split(':')[0] for b in books] + return get_ids(books, prefix) + def find_fulltext(query): ids = [] if sys.platform == 'darwin':