Trying to add qmd files (this is a quarto file, an extension to markdown, and is plain text) so localsearch can do full text searches inside these files.
- Create two test files
test-search.mdandtest-search.qmdboth in the search path defined under Gnome-Search. These files are identical and look like this:Elephants are great! - Use localsearch to look for elephants across my search folders:
localsearch search elephant | grep -E '\.(md|qmd)$', and the test-search.md file is found but not the qmd. - So I added a qmd mimetype like this in
~/.local/share/mime/packages/quarto.xml
and ran<?xml version="1.0" encoding="UTF-8"?> <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"> <mime-type type="text/x-quarto"> <comment>Quarto Document</comment> <sub-class-of type="text/plain"/> <glob pattern="*.qmd"/> </mime-type> </mime-info>update-mime-database ~/.local/share/mime. Checking my test file usingxdg-mime query filetype test_search.qmdyieldstest/quarto. - Next I tested extraction using
localsearch extract test_search.qmdand get this:
which is more or less identical to the output when I extract on the markdown file.@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix nao: <http://tracker.api.gnome.org/ontology/v3/nao#> . @prefix nrl: <http://tracker.api.gnome.org/ontology/v3/nrl#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix fts: <http://tracker.api.gnome.org/ontology/v3/fts#> . @prefix nmm: <http://tracker.api.gnome.org/ontology/v3/nmm#> . @prefix slo: <http://tracker.api.gnome.org/ontology/v3/slo#> . @prefix tracker: <http://tracker.api.gnome.org/ontology/v3/tracker#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix nfo: <http://tracker.api.gnome.org/ontology/v3/nfo#> . @prefix osinfo: <http://tracker.api.gnome.org/ontology/v3/osinfo#> . @prefix nco: <http://tracker.api.gnome.org/ontology/v3/nco#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @prefix nie: <http://tracker.api.gnome.org/ontology/v3/nie#> . @prefix mfo: <http://tracker.api.gnome.org/ontology/v3/mfo#> . <file:///some/folder/in/gnome/search/path/test_search.qmd> nie:plainTextContent "Elephants are great!\n" ; rdf:type nfo:PlainTextDocument . - I added a custom extractor in
~/.local/share/tracker3/extractor-rules/99-quarto.rulecontaining this:
I couldn’t find any documentation on where localsearch looks for this and so I created a symlink in[ExtractorRule] ModulePath=libextract-text.so MimeTypes=text/quarto; FallbackRdfTypes=nfo:Document;nfo:PlainTextDocument;~/.local/share/called localsearch that links to the tracker3 folder.
No amount of resetting the index or restarting the systemd service, results in the new file types being searched.
