Objectify queries: filter by date

后端 未结 1 1569
说谎
说谎 2021-01-14 05:06

I am using GAE and I need to write an Objectify query that asks for the elements created after September 1st.

The dateCreated field is Java.util.Date and it is store

相关标签:
1条回答
  • 2021-01-14 05:29
    1. Your column needs to be indexed

      @Indexed protected Date dateCreated;

    2. You can sort only by one column in a request (> and < and != are all considered sorting since the index is sorted, then analyzed)

    3. You can group dates by loosing precision: 2012-11-29 16:03:59.494000 becomes 2012-11-29 this way, you can use == safely. Create a column for each precision you want (day, week, month). In general, try relying the least possible on sorting operations: sooner or later you will be happy for that choice

    0 讨论(0)
提交回复
热议问题