Your mapping probably did not apply. You can easily check what the mapping
is for a specific type using the get mapping API, and if its not what you
set, then either your Tire config is wrong, or maybe you tried to change
the mapping on an index that already exists and already has mappings for
that field?
To test your suggestion, I created a simpler example and I really do
think that the analyzer is not working in conjunction with facets
correctly. Here is the complete example to demonstrate it:
store :demostring => 'One/Two'
store :demostring => 'One Two'
refresh
end
s = Tire.search 'demo' do
query { all }
facet 'demostring', :global => true do
terms :demostring
end
end
puts "Found #{s.results.count} entries:
#{s.results.map(&:demostring).join(', ')}"
puts "Counts by demostring:", "-"*25
s.results.facets['demostring']['terms'].each do |f|
puts "#{f['term'].ljust(20)} #{f['count']}"
end
With a whitespace analyzer, I would expect one instance of the string
'One', one instance of the string 'Two', and one instance of the
string 'One/Two'. Instead, I got the following:
Counts by demostring:
two 2
one 2
Any suggestions for what I might be doing wrong here?
Your mapping probably did not apply. You can easily check what the mapping
is for a specific type using the get mapping API, and if its not what you
set, then either your Tire config is wrong, or maybe you tried to change
the mapping on an index that already exists and already has mappings for
that field?
To test your suggestion, I created a simpler example and I really do
think that the analyzer is not working in conjunction with facets
correctly. Here is the complete example to demonstrate it:
store :demostring => 'One/Two'
store :demostring => 'One Two'
refresh
end
s = Tire.search 'demo' do
query { all }
facet 'demostring', :global => true do
terms :demostring
end
end
puts "Found #{s.results.count} entries:
#{s.results.map(&:demostring).join(', ')}"
puts "Counts by demostring:", "-"*25
s.results.facets['demostring']['terms'].each do |f|
puts "#{f['term'].ljust(20)} #{f['count']}"
end
With a whitespace analyzer, I would expect one instance of the string
'One', one instance of the string 'Two', and one instance of the
string 'One/Two'. Instead, I got the following:
Counts by demostring:
two 2
one 2
Any suggestions for what I might be doing wrong here?
Your mapping probably did not apply. You can easily check what the
mapping
is for a specific type using the get mapping API, and if its not what
you
set, then either your Tire config is wrong, or maybe you tried to change
the mapping on an index that already exists and already has mappings for
that field?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.