Smart Search Filtering by Date

Tracey Penberthy asked on April 4, 2017 17:36

Hi

In smart search filtering does 'created' map to the Published on field on a page?

I am getting unexpected results when putting the following into Search Preview in the Smart Search app

+_created;[200802020101 TO 201006020101]

By unexpected results I mean documents published outside that range are also getting returned.

Is there something wrong with my syntax here or are my expectations incorrect (i.e. created refers to something other than Published on)?

Many Thanks Tracey

Recent Answers


Trevor Fayas answered on April 4, 2017 17:43

I recall date time filters can be a bit of a pain. First use LUKE 4.0 to check your index, for mine the "documentcreatedwhen" time field is in the format yyyymmddhhmmss, your filter only has yyyymmddhhmm, so you may need to add the seconds on there. It's doing less of an integer search and more of a text search i believe.

Try that, use Luke 4.0 to do your own search parameters on your index first to see if you can get the syntax right, then apply to the filter.

https://code.google.com/archive/p/luke/downloads

0 votesVote for this answer Mark as a Correct answer

Peter Mogilnitski answered on April 6, 2017 17:36

The syntax is correct. Did you assign Date Field in your page type/search fields?

Image Text

_created is matching Date Field (New Release Date) on the picture

0 votesVote for this answer Mark as a Correct answer

Tracey Penberthy answered on April 6, 2017 17:43

Thanks Peter and Trevor

I got it working the end by adding brackets

+_created:([20170101000000 TO 20171231235959])

I think as Trevor suggested the search preview was doing more of a text search before.

Appreciate your help with this

Tracey

1 votesVote for this answer Mark as a Correct answer

Peter Mogilnitski answered on April 6, 2017 19:03

I missed the fact that your put ; instead of : in your first post. Date search in Lucene is inclusive. So you can do +_created:[20170101 TO 20180101] to search of entire 2017, you don't need seconds and parentheses.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.