Indexable field

Topics: Customizing Orchard, Writing modules
Jun 26, 2012 at 9:47 AM

How do I make my fields indexable?

Also, I'm currently storing the field data as a json string, do I need to change this to make it possible to index it?

Coordinator
Jun 26, 2012 at 6:10 PM

There is an event in the content handler for indexing stuff. There is a generic one for all fields, but you can create your own. Just create a Handler with an OnIndexing event, check if the current content item has one of this field, then index the value as you wish.

Jun 27, 2012 at 7:10 AM
Edited Jun 27, 2012 at 8:35 AM

For the generic, is it correct that it only indexes the 'default' (null key) string value of the field?

edit: Think it is, got indexing working for one of my fields now :)

Jun 27, 2012 at 8:36 AM
Edited Jun 27, 2012 at 10:22 AM

Now I have an other question : how can I customize how a result is rendered? Currently it just spits out the results with all content rendered after each other.

I'd want something like a regular search result (like google)

edit: Ok, might have something myself here : I made an override for the default Search that has uses another display type (SearchSummary) and I think that should do

Coordinator
Jun 27, 2012 at 6:06 PM

Yep, it's a good solution. Maybe we could add a way to add more alternate on the search results. You might want to open a bug for that.