本文整理匯總了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();
}
};
}