Module: SimpleSolrClient::Schema::Analysis

Included in:
FieldType
Defined in:
lib/simple_solr_client/schema/analysis.rb

Instance Method Summary collapse

Instance Method Details

#index_input_valid?(val) ⇒ Boolean

Returns:

  • (Boolean)


63
64
65
66
67
68
# File 'lib/simple_solr_client/schema/analysis.rb', line 63

def index_input_valid?(val)
  index_tokens(val)
rescue SimpleSolrClient::Schema::InvalidTokenError, RuntimeError => e
  puts "IN HERE"
  require 'pry'; binding.pry
end

#index_tokens(val) ⇒ Array

Get an array of tokens as analyzed/transformed at index time Note that you may have multiple values at each token position if you use a synonym filter or a stemmer

Examples:

Results when there’s a stemmer

c.fieldtype_index_tokens 'text', "That's Life"
  => [["that's", "that"], "life"]

Parameters:

  • ft (String)

    the name of the fieldType (not the field)

  • val (String)

    the search string to parse

Returns:

  • (Array)

    An array of tokens as produced by that index analysis chain



58
59
60
# File 'lib/simple_solr_client/schema/analysis.rb', line 58

def index_tokens(val)
  fieldtype_tokens(val, 'index')
end

#query_tokens(val) ⇒ Object

Get an array of tokens as analyzed/transformed at query time See #fieldtype_index_tokens



73
74
75
# File 'lib/simple_solr_client/schema/analysis.rb', line 73

def query_tokens(val)
  fieldtype_tokens(val, 'query')
end