Skip to content

Poly Search

Frederico Andrade edited this page Apr 9, 2018 · 14 revisions

Desired behavior

The ideal state of search within the Poly app allows users to conduct searches within two distinct contexts; local, and global

Contexts

Local

From within a book, a search is constrained to the phrases within it.

Global

From everywhere outside an individual book, a user should be able to conduct a search on all of the data within Poly.

For example, running a search from the dashboard, all of the documents and phrases on the store would be searched through for the corresponding result.

Modular search

Poly should support complex search, with integrated filtering for available properties (such as source or target language presently).

For example, the user should be able to search for a specific phrase in a specific language. "How do I say 'welcome' in Japanese?" would search for all ? - japanese phrasebooks that have the string 'welcome'.

Refer to the Data Structures wiki for more information about language names

Example queries

  • Find all books in german (had german in source or target language)
  • Find all books between english and spanish (has english and spanish as source and target languages in either direction)
  • Find all books from english to spanish (source is english, target is spanish)
  • Find all books by author
  • Find all books by date
  • How do you say 'welcome' in japanese (book has japanese, phrase has 'welcome')

Poly schema

From Schema

# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.


ActiveRecord::Schema.define(version: 20180103140920) do


  # These are extensions that must be enabled in order to support this database
  enable_extension "plpgsql"


  create_table "books", force: :cascade do |t|
    t.string   "title",             null: false
    t.datetime "created_at",        null: false
    t.datetime "updated_at",        null: false
    t.string   "description"
    t.string   "source_language",   null: false
    t.string   "target_language",   null: false
    t.integer  "user_id",           null: false
    t.string   "video_description"
  end


  add_index "books", ["user_id"], name: "index_books_on_user_id", using: :btree


  create_table "favorite_books", force: :cascade do |t|
    t.integer  "book_id"
    t.integer  "user_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end


  create_table "phrase_pairs", force: :cascade do |t|
    t.datetime "created_at",    null: false
    t.datetime "updated_at",    null: false
    t.text     "source_phrase", null: false
    t.text     "target_phrase", null: false
    t.integer  "book_id",       null: false
  end


  add_index "phrase_pairs", ["book_id"], name: "index_phrase_pairs_on_book_id", using: :btree


  create_table "users", force: :cascade do |t|
    t.string   "email",                  default: "",    null: false
    t.string   "encrypted_password",     default: "",    null: false
    t.string   "reset_password_token"
    t.datetime "reset_password_sent_at"
    t.datetime "remember_created_at"
    t.integer  "sign_in_count",          default: 0,     null: false
    t.datetime "current_sign_in_at"
    t.datetime "last_sign_in_at"
    t.inet     "current_sign_in_ip"
    t.inet     "last_sign_in_ip"
    t.datetime "created_at",                             null: false
    t.datetime "updated_at",                             null: false
    t.string   "username"
    t.boolean  "admin",                  default: false, null: false
  end


  add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
  add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
  add_index "users", ["username"], name: "index_users_on_username", unique: true, using: :btree


  add_foreign_key "books", "users"
end```