gpt4 book ai didi

google-app-engine - Appengine Search API 按日期和时间搜索

转载 作者:太空宇宙 更新时间:2023-11-03 15:28:18 25 4
gpt4 key购买 nike

我想知道如何从纪元日期时间字段(例如 1362960734565)开始有一个毫秒,我可以轻松搜索(例如在 1234560123456 之后创建的所有文档),或者我是否需要实现某种方法来拆分日期或放置它以另一种格式显示,因为它不能用作数字或日期。

根据 Google 的搜索 API ( https://developers.google.com/appengine/docs/java/search/overview#Describing_Data_with_Documents ) 文档:

Document Fields

Each document contains fields that will contain a particular type of content. The content type is identified by a Field builder to set a field's content type as follows:

  • TEXT: plain text
  • HTML: HTML formatted text
  • ATOM: a string which is treated as a single token
  • NUMBER: a numeric value (either float or integer) between 2,147,483,647 and -2,147,483,647
  • DATE: a date with no time component
  • GEO_POINT: a locale based on latitude and longitude

最佳答案

我目前的解决方案:

将时间戳作为 DateTime,我将日期存储在 Date 字段类型中,然后获取当天的毫秒数并将其存储为数字。

然后我针对这两个字段使用数字运算符构建搜索 API 的查询,例如:

dayLastUpdated >= 2013-3-13 AND timeLastUpdated > 82884753

关于google-app-engine - Appengine Search API 按日期和时间搜索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15329582/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com