sunspot/sunspot — Issue #137: Indexing and Searching accross renamed fields should allow to use each field more than once
Author: abkonsta
Created: 2011-12-06 16:18:25+00:00
State: open

When indexing the records like this

searchable do
text :description, :as => :desc_lvl1
text :search, :as => :search_lvl1
text :description, :as => :desc_lvl2
text :search, :as => :search_lvl2
end

with the purpose of applying different filters to the same field, sunspot only indexes and searches the last two times these fields are mentioned, apparently because it sees each of the original field names (:description and :search) duplicated, so it only honors the last time each of them is mentioned.

When doing a full text search in this scenario

search = self.solr_search do
fulltext term
end

The resulting query is

+(desc_lvl2:SKRL | search_lvl2:SKRL) ()

it does not include desc_lvl1 and search_lvl1.