What features would you want for a `q` Querystring parser? (e.g. full-text-search, or more?)

patarapolw

Pacharapol Withayasakpunt

Posted on December 3, 2020

What features would you want for a `q` Querystring parser? (e.g. full-text-search, or more?)

It might also govern which database you will choose... just MongoDB with full-text-search, or do you need Elasticsearch or something else? Will the data be duplicated?

Not sure about PostGres, MySQL, MariaDB, but SQLite does have an awesome full-text-search engine (e.g. FTS5).

CREATE TABLE IF NOT EXISTS files (
  id            TEXT PRIMARY KEY,
  lastRead      FLOAT,            -- +new Date() number; nullable
  rating        FLOAT DEFAULT 0
);

CREATE INDEX IF NOT EXISTS files_lastRead ON files(lastRead);
CREATE INDEX IF NOT EXISTS files_rating ON files(rating);

CREATE VIRTUAL TABLE IF NOT EXISTS q USING fts5(
  fileId,         -- REFERENCES files(id)
  author,         -- ', ' joined Set
  title,          -- ', ' joined Set
  tag,            -- ', ' joined Set
  frontmatter,    -- other searchable frontmatter
  content         -- cleaned markdown-to-plaintext
);
Enter fullscreen mode Exit fullscreen mode

But, is only full-text-search really enough? Some of other features I would be dying for includes

  • Search by fields
  • Number fields
  • Datetime fields
  • Boolean operators / brackets
  • Wildcards
  • Fuzzy search
  • Language-specific normalizations

GitHub logo patarapolw / qsearch

Search a database with a string. Designed for end-users.

Personally, I don't care about field boosting much, but it is featured in some search engines.

💖 💪 🙅 🚩
patarapolw
Pacharapol Withayasakpunt

Posted on December 3, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related