Module: Textacular

Defined in:
lib/textacular.rb,
lib/textacular/rails.rb,
lib/textacular/version.rb,
lib/textacular/postgres_module_installer.rb

Defined Under Namespace

Modules: Helper Classes: FullTextIndexer, MigrationGenerator, PostgresModuleInstaller, Railtie, TrigramInstaller

Constant Summary collapse

VERSION =
'5.3.0'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.searchable_languageObject


11
12
13
# File 'lib/textacular.rb', line 11

def self.searchable_language
  'english'
end

.versionObject


4
5
6
# File 'lib/textacular/version.rb', line 4

def self.version
  VERSION
end

Instance Method Details

#advanced_search(query = "", exclusive = true, rank_alias = nil) ⇒ Object


26
27
28
29
30
31
# File 'lib/textacular.rb', line 26

def advanced_search(query = "", exclusive = true, rank_alias = nil)
  exclusive, query = munge_exclusive_and_query(exclusive, query)
  parsed_query_hash = parse_query_hash(query)
  similarities, conditions = advanced_similarities_and_conditions(parsed_query_hash)
  assemble_query(similarities, conditions, exclusive, rank_alias)
end

#basic_search(query = "", exclusive = true, rank_alias = nil) ⇒ Object


19
20
21
22
23
24
# File 'lib/textacular.rb', line 19

def basic_search(query = "", exclusive = true, rank_alias = nil)
  exclusive, query = munge_exclusive_and_query(exclusive, query)
  parsed_query_hash = parse_query_hash(query)
  similarities, conditions = basic_similarities_and_conditions(parsed_query_hash)
  assemble_query(similarities, conditions, exclusive, rank_alias)
end

#fuzzy_search(query = '', exclusive = true, rank_alias = nil) ⇒ Object


33
34
35
36
37
38
# File 'lib/textacular.rb', line 33

def fuzzy_search(query = '', exclusive = true, rank_alias = nil)
  exclusive, query = munge_exclusive_and_query(exclusive, query)
  parsed_query_hash = parse_query_hash(query)
  similarities, conditions = fuzzy_similarities_and_conditions(parsed_query_hash)
  assemble_query(similarities, conditions, exclusive, rank_alias)
end

#search(query = "", exclusive = true, rank_alias = nil) ⇒ Object


15
16
17
# File 'lib/textacular.rb', line 15

def search(query = "", exclusive = true, rank_alias = nil)
  basic_search(query, exclusive, rank_alias)
end

#web_search(query = '', exclusive = true, rank_alias = nil) ⇒ Object


40
41
42
43
44
45
# File 'lib/textacular.rb', line 40

def web_search(query = '', exclusive = true, rank_alias = nil)
  exclusive, query = munge_exclusive_and_query(exclusive, query)
  parsed_query_hash = parse_query_hash(query)
  similarities, conditions = web_similarities_and_conditions(parsed_query_hash)
  assemble_query(similarities, conditions, exclusive, rank_alias)
end