Great, this is the first example I have seen so far, I wish we could include this in the Wiki. Thanks again!
On Wed, Feb 4, 2015 at 2:04 PM, Chris Hostetter <hossman_luc...@fucit.org> wrote: > : > : Thanks for giving multiple options , I ll try them out both ,but last > time > : I checked, having "+60SECONDS" as the default value for ttl was giving me > : an invalid date format exception...., I am assuming that would only be > the > > that's because ttl should not be a date field -- it should be a *string* > (as noted in my examples) > > "time to live" is a date math expression that the processor will evaluate > for you -- not a date. if you want to specify an explicit date, just set > expire_at directly. > > ie: do you wnat to do the match yourself (set expire_at as a date field) > or do you want the processor to do the math itself (set ttl as a string > field) > > : > ...even if you redefined your ttl field to look like this... > : > > : > <field name="ttl" type="string" default="+60SECONDS" /> > : > > : > ...the expire_at still wouldn't be populated by the processor because > : > schema field "default" values are populated *after* the processors run > -- > : > so when the DocExpirationUpdateProcessorFactory sees the documents > being > : > added, it has no idea that they all have a default ttl, so it doesn't > know > : > that you want it to compute an expire_at for you. > : > > : > instead of using default="" in the schema, you can use the > : > DefaultValueUpdateProcessorFactory to assign it *before* the > : > DocExpirationUpdateProcessorFactory sees the doc... > : > > : > <processor class="solr.DefaultValueUpdateProcessorFactory"> > : > <str name="fieldName">ttl</str> > : > <str name="value">+60SECONDS</str> > : > </processor> > > > -Hoss > http://www.lucidworks.com/ >