module PG::FTS
Public Instance Methods
catalog()
click to toggle source
# File lib/pg/fts.rb, line 8 def catalog 'pg_catalog.simple' end
clear() { |truncate_table_query| ... }
click to toggle source
# File lib/pg/fts.rb, line 65 def clear yield(truncate_table_query) end
create() { |create_table_query| ... }
click to toggle source
# File lib/pg/fts.rb, line 55 def create yield(create_table_query) yield(create_key_index_query) yield(create_tsv_index_query) end
create_key_index_query()
click to toggle source
# File lib/pg/fts.rb, line 24 def create_key_index_query <<-SQL.gsub(/^ {4}/, '') CREATE UNIQUE INDEX "#{PG::FTS.table}_idx" ON "#{PG::FTS.table}" ( "document_table", "document_id", "source_table", "source_id"); SQL end
create_table_query()
click to toggle source
# File lib/pg/fts.rb, line 12 def create_table_query <<-SQL.gsub(/^ {4}/, '') CREATE TABLE "#{PG::FTS.table}" ( "id" SERIAL, "document_table" VARCHAR(255), "document_id" INT, "source_table" VARCHAR(255), "source_id" INT, "tsv" TSVECTOR); SQL end
create_tsv_index_query()
click to toggle source
# File lib/pg/fts.rb, line 35 def create_tsv_index_query <<-SQL.gsub(/^ {4}/, '') CREATE INDEX "#{PG::FTS.table}_tsv_idx" ON "#{PG::FTS.table}" USING GIN ("tsv"); SQL end
drop() { |drop_table_query| ... }
click to toggle source
# File lib/pg/fts.rb, line 61 def drop yield(drop_table_query) end
drop_table_query()
click to toggle source
# File lib/pg/fts.rb, line 43 def drop_table_query <<-SQL.gsub(/^ {4}/, '') DROP TABLE "#{PG::FTS.table}" SQL end
table()
click to toggle source
# File lib/pg/fts.rb, line 4 def table 'fts' end
truncate_table_query()
click to toggle source
# File lib/pg/fts.rb, line 49 def truncate_table_query <<-SQL.gsub(/^ {4}/, '') TRUNCATE "#{PG::FTS.table}"; SQL end