简体   繁体   中英

SOLR Date range

I have to make an ezfind search page with date functions. For the SOLR filter I tried to use something like this: attr_publish_date_dt:[NOW-6MONTH TO NOW] but I don't get any result. If I use it this way attr_publish_date_dt:[* TO NOW], it works. But all queries without an asterisk on the left hand don't work.

attr_publish_date_dt contains a unix timestamp so I also tried to use 2 timestamps from the attr_publish_date_dt:[* TO NOW] result, instead of [NOW-6MONTH TO NOW], but then I get also no results.

Can anyone help me please? Thanks in advance Frank

Date searches are supported on a date field. You will need to define a field of that type, and submit dates in ISO-8601 format.

http://lucene.apache.org/solr/4_4_0/solr-core/org/apache/solr/schema/DateField.html

If you cannot properly format the timestamp before sending it to Solr, you may be able to use a DateFormatTransformer or a ScriptTransformer to do the job.

http://wiki.apache.org/solr/DataImportHandler#DateFormatTransformer http://wiki.apache.org/solr/DataImportHandler#ScriptTransformer

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM