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

Support arbitrary index directly on the field #172

Open
robertjpayne opened this issue Oct 25, 2015 · 1 comment
Open

Support arbitrary index directly on the field #172

robertjpayne opened this issue Oct 25, 2015 · 1 comment

Comments

@robertjpayne
Copy link

I want to create a tags index where the index is lowercased but the field is stored as is. Basically Twitter style where tags can be whatever case and appear in the case the author wrote them but querying is done entirely lowercased.

Currently NoBrainer complains if you do:

field :tags, type: Array
index :tags, lambda { |doc|
  doc[:tags].map { |tag| tag.downcase }
}, multi: true

I'm a bit OCD here and would like the field/index name to be the same so I attempted to move the index directly into the field declaration but then I cannot specify it's a multi index.

Is this something that could be supported easily? Otherwise I can just suffice with custom index name :)

@nviennot
Copy link
Collaborator

Perhaps it would be a good idea to not have to specify a name and let nobrainer pick a default name (like simple and compound indexes).
In the meantime you can name it ltags ;)

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

2 participants