Skip to content

non-intuitive date-only search #10

@bcampbell

Description

@bcampbell

When searching a date/time field for, say, a particular date, the 'intuitive' approach doesn't work:

pubdate:2011-02-01

You currently have to use range syntax:
pubdate: [2011-02-01 TO 2011-02-01]

This is pretty sucky. The problem is that the parser has to know if it's generating a straight term query or a range query. It doesn't know what type each field is.

Two ideas I have on how to approach this:

  1. add a setting to the query parser which lets you specific which fields are numeric (or date/time).
  2. treat anything that looks like a date/time as a range query.

I think 2 falls down because it's perfectly reasonable to index YYYY-MM-DD strings in a string field, and they won't be matched properly if the query parser assumes it's a numeric field.

So I'm leaning toward solution 1 right now.
I'm thinking that there should be options to tell the query parser more about the fields anyway - for example so it can throw up a syntax error if an unknown field is entered (or mis-spelled). So specifying a field type doesn't seem like too big a leap from this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions