简体   繁体   English

天蓝色搜索服务和开放时间

[英]azure search service and opening hours

Consider same situation, that Microsoft uses in their azure search examples - hotel search system, but azure search should provide filter for opened hotels. 考虑相同的情况,Microsoft在其天蓝色搜索示例中使用了酒店搜索系统,但天蓝色搜索应为已打开的酒店提供过滤器。

Any ideas how to store information about opening hours (source model contains two intervals for each day - before/after lunch) to be useful for filters? 有什么想法可以存储有关开放时间的信息(源模型每天包含两个时间间隔-午餐之前/之后),这对于过滤器很有用吗?

The easiest solution I've found (definitely not the prettiest one) was to create fields for each day, both intervals and both start and stop timestamps (only Time typed). 我发现的最简单的解决方案(绝对不是最漂亮的解决方案)是为每天创建字段,包括时间间隔以及开始和停止时间戳记(仅输入时间)。 Then use appropriate day values and current time in filter params. 然后在过滤器参数中使用适当的日期值和当前时间。 Whole solution needs 7 x 2 x 2 fields to be created. 整个解决方案需要创建7 x 2 x 2字段。

Anyone with better solution, maybe using default features of Azure Search Engine? 有更好的解决方案的人,也许使用Azure搜索引擎的默认功能?

That approach would work. 这种方法行得通。 Here's an alternative approach that uses one field instead of 28: Let's say all of your open / close times are on 1-hour boundaries (of course, the same approach will work for 30-min or 15-min boundaries). 这是使用一个字段而不是28的另一种方法:假设您所有的开放/关闭时间都在1小时的边界上(当然,相同的方法适用于30分钟或15分钟的边界)。 For each hotel, generate terms for all intervals describing whether the hotel is open or closed at that time: "Mon12AMClosed", "Mon1AMClosed", ..., "Mon6AMOpened", ..., "Tue12AMClosed",..... Index all these terms into a string collection field. 对于每个酒店,请为所有间隔生成描述酒店当时处于开放还是关闭状态的术语:“ Mon12AMClosed”,“ Mon1AMClosed”,...,“ Mon6AMOpened”,...,“ Tue12AMClosed”,.....将所有这些术语编入字符串收集字段。 At query time, map the current time into the appropriate interval (such as "Wed12PMOpen" to find out which hotels are open on Wed in 12PM - 1PM interval), and use a filter expression similar to: 在查询时间,将当前时间映射到适当的时间间隔(例如“ Wed12PMOpen”,以找出哪些酒店在Wed以12PM-1PM间隔开放),并使用类似于以下内容的过滤器表达式:

$filter = intervals/any(t: t eq "Wed12PMOpen") $ filter = interval / any(t:t eq“ Wed12PMOpen”)

HTH, Eugene HTH,尤金

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM