All Projects → gvolpe → fts

gvolpe / fts

Licence: Apache-2.0 license
🔍 Postgres full-text search (fts)

Programming Languages

haskell
3896 projects
scala
5932 projects
Nix
1067 projects

Projects that are alternatives of or similar to fts

Pyfladesk
create desktop application by using Flask and QtWebKit
Stars: ✭ 399 (+1325%)
Mutual labels:  gui-application, desktop-application
Guark
Build awesome Golang desktop apps and beautiful interfaces with Vue.js, React.js, Framework 7, and more...
Stars: ✭ 334 (+1092.86%)
Mutual labels:  gui-application, desktop-application
Neel
A Nim library for making Electron-like HTML/JS GUI apps, with full access to Nim capabilities.
Stars: ✭ 144 (+414.29%)
Mutual labels:  gui-application, desktop-application
glimmer-cs-gladiator
Gladiator (Glimmer Editor) - Glimmer Custom Shell
Stars: ✭ 26 (-7.14%)
Mutual labels:  gui-application, desktop-application
dotfiles
My personal dotfiles
Stars: ✭ 71 (+153.57%)
Mutual labels:  nix
presentations
Presentations at the Tokyo Nixos Meetup
Stars: ✭ 57 (+103.57%)
Mutual labels:  nix
OotD
Outlook on the Desktop (OotD)
Stars: ✭ 76 (+171.43%)
Mutual labels:  desktop-application
nix-articles
Some articles about getting started with Nix programming & configuration
Stars: ✭ 134 (+378.57%)
Mutual labels:  nix
libnvc
Easy way to embed (neo)vim in your application
Stars: ✭ 32 (+14.29%)
Mutual labels:  gui-application
emergency-kexec
Kexec into an in-memory emergency system
Stars: ✭ 21 (-25%)
Mutual labels:  nix
lunr-module
Full-text search with pre-build indexes for Nuxt.js using lunr.js
Stars: ✭ 45 (+60.71%)
Mutual labels:  full-text-search
glyphcollector
glyphcollector.app
Stars: ✭ 47 (+67.86%)
Mutual labels:  desktop-application
meteor
https://d2a4u.github.io/meteor/
Stars: ✭ 17 (-39.29%)
Mutual labels:  fs2
cryptopunks
(crypto) pixel punks - libraries, tools & scripts, and more
Stars: ✭ 24 (-14.29%)
Mutual labels:  desktop-application
Lurka
4chan desktop app for power users
Stars: ✭ 29 (+3.57%)
Mutual labels:  desktop-application
rnix-parser
A Nix parser written in Rust [maintainer=@oberblastmeister]
Stars: ✭ 246 (+778.57%)
Mutual labels:  nix
naersk
Build rust crates in Nix. No configuration, no code generation, no IFD. Sandbox friendly. [maintainer: @Patryk27]
Stars: ✭ 440 (+1471.43%)
Mutual labels:  nix
tamer
Standalone alternatives to Kafka Connect Connectors
Stars: ✭ 42 (+50%)
Mutual labels:  fs2
haskell-overridez
Simplify usage of nix dependencies during haskell development
Stars: ✭ 32 (+14.29%)
Mutual labels:  nix
gitignore.nix
Nix functions for filtering local git sources
Stars: ✭ 175 (+525%)
Mutual labels:  nix

fts (full-text search)

CI Status

Full-text search demo powered by PostgreSQL, inspired by this article.

Overview

There are three components in this project: the dataset loader and both full-text search applications: a console app and a GUI app, described below.

The idea behind this demo project is to showcase the full-text search feature offered by PostgreSQL, as well as another example of a native multi-platform desktop GUI application written in Haskell.

It also showcases the power of functional effectful streams on the Scala side.

Overall, it was just a fun pet project 🤓

System requirements

Before anything else, we need a PostgreSQL instance up and running. You can use the supplied docker-compose.yml file, or have your own instance running.

If you care about reproducibility, then Nix is your best friend. If not, you can try and build the project via cabal new-build, good luck with that 😉

$ cachix use fts
$ nix-build
...
$ ls result/bin/
fts fts-ui

The first command is optional but recommended, if you don't want to compile the world! Once the build is complete, you'll find two executables corresponding the two applications described below.

Full-text search console app

In the console app, you can search movies by title (hit Ctrl + C to exit).

console-app

NOTE: Your terminal needs to support the rendering of emojis and Unicode characters. Make sure you have a modern font installed in your system. In my case, I use Alacritty and JetBrainsMono.

Full-text search GUI app

The GUI application is richer in features, powered by the monomer package, and adapted from the books example.

ui-app

In addition to searching movies in Postgres, it tries to fetch the movie poster from TMDB, if the TMDB_API_KEY environment variable is set. To get one, have a look at the instructions.

NOTE: Non-NixOS users need to run fts-ui via nixGL, due to some complicated OpenGL linking issues. TL;DR:

$ nix-channel --add https://github.com/guibou/nixGL/archive/main.tar.gz nixgl
$ nix-channel --update
$ nix-env -iA nixgl.auto.nixGLDefault

Then run the program as nixGL result/bin/fts-ui instead.

Dataset loader

The loader is a nix shell script interpreted by Ammonite, written in Scala, which reads a movies CSV file, parses its content, and it stores them in Postgres. These tasks are made easy by fs2, fs2-data, and skunk.

$ cd data
$ ./Loader.sc

If you wish to change the Postgres connection details, have a look at the configuration file.

Technical details

Every time a title is entered, a full-text search is performed against Postgres via the following query, which orders the results by the corresponding ranking (ts_rank).

SELECT title_id, title, genre, year, language, description, actors
FROM movies
WHERE ts @@ to_tsquery('english', ?)
ORDER BY ts_rank(ts, to_tsquery('english', ?)) DESC

The console application only displays the title together with a link to the movie in imdb but anything should be possible with a bit of customization, as done in the GUI application.

Dataset License

The movies dataset is licensed under CC0 1.0, downloaded from here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].