Martin Davies
Martin Davies

Reputation: 4456

Sitecore Advanced Database Crawler numeric dynamic fields

With ADC / scSearchContrib, is it possible for a dynamic field to be treated as numeric in lucene?

Upvotes: 1

Views: 318

Answers (2)

Martin Davies
Martin Davies

Reputation: 4456

Looking at the NumberFieldCrawler class in the scSearchContrib solution has led to me the answer I think.

it contains the following code which seems to be what Lucene needs.

 long value;

 if (!String.IsNullOrEmpty(_field.Value) && long.TryParse(_field.Value, out value))
 {
     return NumberTools.LongToString(value);
 }

Upvotes: 2

Martijn van der Put
Martijn van der Put

Reputation: 4082

Download the source of the Crawler here

There is an example of a custom FieldCrawler for a dynamic field in the class AllTemplatesField

Also notice that this custom FieldCrawler is added in the web.config in the section /crawlers/dynamicFields/

This should get you started, I guess.

Upvotes: 1

Related Questions