MacHu-GWU / afwf_fts_anything-project

Alfred Workflow, Full Text Search Anything

Home Page:https://github.com/MacHu-GWU/afwf_fts_anything-project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

https://img.shields.io/badge/release_history--None.svg?style=social https://img.shields.io/badge/STAR_Me_on_GitHub!--None.svg?style=social

The Alfred Workflow: Full Text Search Anything

Introduction

afwf_fts_anything is an Alfred Workflow allows you to do full-text search on your own dataset, and use the result to open url, open file, run script, or basically do anything. Typically, you need to setup expansive elasticsearch server, learn how to do data ingestion, learn search API, and build your own Alfred workflow. afwf_fts_anything removes all the blockers and let you just focus on your dataset and search configuration.

Demo

https://user-images.githubusercontent.com/6800411/50622795-1fc45580-0ede-11e9-878c-64e2ab6292b1.gif

Sample Data Set, IMDB Top 250 movies (content of movie.json):

[
    {
        "movie_id": 1,
        "title": "The Shawshank Redemption",
        "description": "Two imprisoned men bond over a number of years, finding solace and eventual redemption through acts of common decency.",
        "genres": "Drama",
        "rating": 9.2,
        "url": "https://www.imdb.com/title/tt0111161"
    },
    {
        "movie_id": 2,
        "title": "The Godfather",
        "description": "The aging patriarch of an organized crime dynasty transfers control of his clandestine empire to his reluctant son.",
        "genres": "Crime, Drama",
        "rating": 9.2,
        "url": "https://www.imdb.com/title/tt0068646"
    },
    {
        "movie_id": 3,
        "title": "The Dark Knight",
        "description": "When the menace known as the Joker wreaks havoc and chaos on the people of Gotham, Batman must accept one of the greatest psychological and physical tests of his ability to fight injustice.",
        "genres": "Action, Crime, Drama",
        "rating": 9.0,
        "url": "https://www.imdb.com/title/tt0468569"
    },
    {
        "movie_id": 4,
        "title": "12 Angry Men",
        "description": "The jury in a New York City murder trial is frustrated by a single member whose skeptical caution forces them to more carefully consider the evidence before jumping to a hasty verdict.",
        "genres": "Crime, Drama",
        "rating": 9.0,
        "url": "https://www.imdb.com/title/tt0050083"
    },
    {
        "movie_id": 5,
        "title": "Schindler's List",
        "description": "In German-occupied Poland during World War II, industrialist Oskar Schindler gradually becomes concerned for his Jewish workforce after witnessing their persecution by the Nazis.",
        "genres": "Biography, Drama, History",
        "rating": 8.9,
        "url": "https://www.imdb.com/title/tt0108052"
    },
    {
        "movie_id": 6,
        "title": "The Lord of the Rings: The Return of the King",
        "description": "Gandalf and Aragorn lead the World of Men against Sauron's army to draw his gaze from Frodo and Sam as they approach Mount Doom with the One Ring.",
        "genres": "Action, Adventure, Drama",
        "rating": 8.9,
        "url": "https://www.imdb.com/title/tt0167260"
    },
    {
        "movie_id": 7,
        "title": "Pulp Fiction",
        "description": "The lives of two mob hitmen, a boxer, a gangster and his wife, and a pair of diner bandits intertwine in four tales of violence and redemption.",
        "genres": "Crime, Drama",
        "rating": 8.8,
        "url": "https://www.imdb.com/title/tt0110912"
    },
    {
        "movie_id": 8,
        "title": "Fight Club",
        "description": "An insomniac office worker and a devil-may-care soap maker form an underground fight club that evolves into much more.",
        "genres": "Drama",
        "rating": 8.7,
        "url": "https://www.imdb.com/title/tt0137523"
    },
    {
        "movie_id": 9,
        "title": "Saving Private Ryan",
        "description": "Following the Normandy Landings, a group of U.S. soldiers go behind enemy lines to retrieve a paratrooper whose brothers have been killed in action.",
        "genres": "Drama, War",
        "rating": 8.6,
        "url": "https://www.imdb.com/title/tt0120815"
    }
]

Sample search settings (content of movie-setting.json):

{
    // define how you want to search this dataset
    "fields": [
        {
            "name": "movie_id",
            "type_is_store": true
        },
        {
            "name": "title",
            "type_is_store": true,
            "type_is_ngram": true,
            "ngram_maxsize": 10,
            "ngram_minsize": 2,
            "weight": 2.0
        },
        {
            "name": "description",
            "type_is_store": true,
            "type_is_phrase": true
        },
        {
            "name": "genres",
            "type_is_store": true,
            "type_is_keyword": true,
            "keyword_lowercase": true,
            "weight": 1.5
        },
        {
            "name": "rating",
            "type_is_store": true,
            "type_is_numeric": true,
            "is_sortable": true,
            "is_sort_ascending": false
        }
    ],
    "title_field": "{title} ({genres}) rate {rating}", // title on Alfred drop down menu
    "subtitle_field": "{description}", // subtitle on Alfred drop down menu
    "arg_field": "{url}", // argument for other workflow component
    "autocomplete_field": "{title}", // tab auto complete behavior
    "icon_field": "movie-icon.png"
}

Note:

afwf_fts_anything support comments in json, you don't have to remove it to use.

User Guide

Projects based on afwf_fts_anything

About

Alfred Workflow, Full Text Search Anything

https://github.com/MacHu-GWU/afwf_fts_anything-project

License:MIT License


Languages

Language:Python 98.0%Language:Makefile 2.0%