Class: ActsAsIndexed::Configuration
- Inherits:
-
Object
- Object
- ActsAsIndexed::Configuration
- Defined in:
- lib/acts_as_indexed/configuration.rb
Overview
Used to set up and modify settings for acts_as_indexed.
Instance Attribute Summary collapse
-
#case_sensitive ⇒ Object
Enable or disable case sensitivity.
-
#disable_auto_indexing ⇒ Object
Disable indexing, useful for large test suites.
-
#if_proc ⇒ Object
Proc that allows you to turn on or off index for a record.
-
#index_file ⇒ Object
Since we cannot expect Rails to be available on load, it is best to put off setting the index_file attribute until as late as possible.
-
#index_file_depth ⇒ Object
Tuning value for the index partitioning.
-
#is_windows_filesystem ⇒ Object
writeonly
Disable advanced features not compatible with the Windows filesystem.
-
#min_word_size ⇒ Object
Sets the minimum length for a word in a query.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #is_windows_filesystem? ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
38 39 40 41 42 43 44 45 46 |
# File 'lib/acts_as_indexed/configuration.rb', line 38 def initialize @index_file = nil @index_file_depth = 3 @min_word_size = 3 @if_proc = if_proc @case_sensitive = false @disable_auto_indexing = false @is_windows_filesystem = RUBY_PLATFORM[/mswin32|mingw|cygwin/] end |
Instance Attribute Details
#case_sensitive ⇒ Object
Enable or disable case sensitivity. Set to true to enable. Default is false.
26 27 28 |
# File 'lib/acts_as_indexed/configuration.rb', line 26 def case_sensitive @case_sensitive end |
#disable_auto_indexing ⇒ Object
Disable indexing, useful for large test suites. Set to false to disable. Default is false.
31 32 33 |
# File 'lib/acts_as_indexed/configuration.rb', line 31 def disable_auto_indexing @disable_auto_indexing end |
#if_proc ⇒ Object
Proc that allows you to turn on or off index for a record. Useful if you don’t want an object to be placed in the index, such as a draft post.
21 22 23 |
# File 'lib/acts_as_indexed/configuration.rb', line 21 def if_proc @if_proc end |
#index_file ⇒ Object
Since we cannot expect Rails to be available on load, it is best to put off setting the index_file attribute until as late as possible.
7 8 9 |
# File 'lib/acts_as_indexed/configuration.rb', line 7 def index_file @index_file end |
#index_file_depth ⇒ Object
Tuning value for the index partitioning. Larger values result in quicker searches, but slower indexing. Default is 3.
11 12 13 |
# File 'lib/acts_as_indexed/configuration.rb', line 11 def index_file_depth @index_file_depth end |
#is_windows_filesystem=(value) ⇒ Object (writeonly)
Disable advanced features not compatible with the Windows filesystem. Set to true to disable. Default is guessed depending on current platform.
36 37 38 |
# File 'lib/acts_as_indexed/configuration.rb', line 36 def is_windows_filesystem=(value) @is_windows_filesystem = value end |
#min_word_size ⇒ Object
Sets the minimum length for a word in a query. Words shorter than this value are ignored in searches unless preceded by the ‘+’ operator. Default is 3.
16 17 18 |
# File 'lib/acts_as_indexed/configuration.rb', line 16 def min_word_size @min_word_size end |
Instance Method Details
#is_windows_filesystem? ⇒ Boolean
78 79 80 |
# File 'lib/acts_as_indexed/configuration.rb', line 78 def is_windows_filesystem? !!@is_windows_filesystem end |