本文整理汇总了Java中org.elasticsearch.search.internal.SearchContext.nowInMillis方法的典型用法代码示例。如果您正苦于以下问题:Java SearchContext.nowInMillis方法的具体用法?Java SearchContext.nowInMillis怎么用?Java SearchContext.nowInMillis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.search.internal.SearchContext
的用法示例。
在下文中一共展示了SearchContext.nowInMillis方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseLong
import org.elasticsearch.search.internal.SearchContext; //导入方法依赖的package包/类
@Override
public long parseLong(String value, final SearchContext searchContext) {
final Callable<Long> now = new Callable<Long>() {
@Override
public Long call() throws Exception {
return searchContext.nowInMillis();
}
};
return parser.parse(value, now, false, timezone);
}
示例2: nowInMillis
import org.elasticsearch.search.internal.SearchContext; //导入方法依赖的package包/类
public long nowInMillis() {
SearchContext current = SearchContext.current();
if (current != null) {
return current.nowInMillis();
}
return System.currentTimeMillis();
}
示例3: valueForSearch
import org.elasticsearch.search.internal.SearchContext; //导入方法依赖的package包/类
@Override
public Object valueForSearch(Object value) {
long now;
SearchContext searchContext = SearchContext.current();
if (searchContext != null) {
now = searchContext.nowInMillis();
} else {
now = System.currentTimeMillis();
}
long val = value(value);
return val - now;
}
示例4: now
import org.elasticsearch.search.internal.SearchContext; //导入方法依赖的package包/类
private static Callable<Long> now() {
return new Callable<Long>() {
@Override
public Long call() {
final SearchContext context = SearchContext.current();
return context != null
? context.nowInMillis()
: System.currentTimeMillis();
}
};
}