0

Need to get entities filtering by month instead of complete date values (E.g. Birthdays) using Google App Engine Text Search. On verifying GAE docs, I think it is not possible to query date fields by month directly.

So in order to filter them by month/date, we consider saving each date sub value like Date(DD), Month(MM) and Year(YYYY) as separate NUMBER field along with complete date field.

I verified locally that we can achieve by saving like this. But is this the correct way of saving dates by splitting each field when we want to query on date sub values?

Is there any known/unknown limit on number of fields per document apart from 10GB size limit in GAE Text Search?

Please suggest me.

Thanks, Naresh

Dan McGrath
  • 41,220
  • 11
  • 99
  • 130
Naresh M
  • 113
  • 11

1 Answers1

0

The only time NUMBER or DATE fields make sense is if you need to query on ranges of values. In other cases they are wasteful.

I can't tell from your question exactly what queries you want to run. Are you looking for a (single) specific day of the month (e.g., January 6 -- of any year)? Or just "anything in June (again, without regard to year)"? Or is it a date range: something like January 20 through February 19? Or July 1 through September 30?

If it's a range then NUMBER values may make sense. But if it's just a single specific month, or a single month and day-of-month combination, then you're better off storing month and day as separate ATOM fields.

Anything that looks like a number, but isn't really going to be searched via a numerical range, or done arithmetic on, isn't really a number, and is probably best stored as an ATOM. For example, phone numbers, zip codes (unless you're terribly clever and wanting to do something like "all zip codes in San Francisco look like 941xx" -- but even then if that's what you want to do, you're probably better off just storing the "941" prefix as an ATOM).

Alan
  • 690
  • 3
  • 6
  • Hi Alan, Thanks for your reply. Ya we need to save as NUMBER values only as we have date range queries. But I worry about number of columns allowed in Google Text Search as each Date field need 4 columns. – Naresh M Jun 26 '16 at 17:36