Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to index the same field multiple ways? #719

Open
bithive opened this issue Aug 12, 2015 · 0 comments
Open

How to index the same field multiple ways? #719

bithive opened this issue Aug 12, 2015 · 0 comments

Comments

@bithive
Copy link
Contributor

bithive commented Aug 12, 2015

I have noticed that when declaring multiple fields with the same name in a searchable block, the last one wins, even when the dynamic field naming conventions would prevent an actual collision in Solr.

This is what I observe:

# does not get indexed
string :century, multiple: true 

# gets indexed as "century_s"
string :century, multiple: false do
  attributes[:century].join(', ')
end

What I would prefer is:

# gets indexed as "century_sm"
string :century, multiple: true

# gets indexed as "century_s"
string :century, multiple: false do
  attributes[:century].join(', ')
end

In my application I need to index the same fields in different ways to support faceting and sorting, etc. The Sunspot dynamic field naming conventions are convenient for this, but this behavior was unexpected.

Right now I am working around this by changing the name, but it feels a bit redundant since the dynamic field names already capture the distinctions I set up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant