本文整理汇总了Java中com.orientechnologies.orient.core.command.OCommandContext.getVariable方法的典型用法代码示例。如果您正苦于以下问题:Java OCommandContext.getVariable方法的具体用法?Java OCommandContext.getVariable怎么用?Java OCommandContext.getVariable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.orientechnologies.orient.core.command.OCommandContext
的用法示例。
在下文中一共展示了OCommandContext.getVariable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeIndexQuery
import com.orientechnologies.orient.core.command.OCommandContext; //导入方法依赖的package包/类
@Override
public OIndexCursor executeIndexQuery(OCommandContext iContext, OIndex<?> index, List<Object> keyParams, boolean ascSortOrder) {
OIndexCursor cursor;
OIndexDefinition definition = index.getDefinition();
int idxSize = definition.getFields().size();
int paramsSize = keyParams.size();
double distance = 0;
Object spatial = iContext.getVariable("spatial");
if (spatial != null) {
if (spatial instanceof Number) {
distance = ((Double) OType.convert(spatial, Double.class)).doubleValue();
} else if (spatial instanceof Map) {
Map<String, Object> params = (Map<String, Object>) spatial;
Object dst = params.get("maxDistance");
if (dst != null && dst instanceof Number) {
distance = ((Double) OType.convert(dst, Double.class)).doubleValue();
}
}
}
Object indexResult = index.get(new OSpatialCompositeKey(keyParams).setMaxDistance(distance).setContext(iContext));
if (indexResult == null || indexResult instanceof OIdentifiable)
cursor = new OIndexCursorSingleValue((OIdentifiable) indexResult, new OSpatialCompositeKey(keyParams));
else
cursor = new OIndexCursorCollectionValue(((Collection<OIdentifiable>) indexResult), new OSpatialCompositeKey(
keyParams));
iContext.setVariable("$luceneIndex", true);
return cursor;
}
示例2: sendTotalHits
import com.orientechnologies.orient.core.command.OCommandContext; //导入方法依赖的package包/类
public void sendTotalHits(OCommandContext context, TopDocs docs) {
if (context != null) {
if (context.getVariable("totalHits") == null) {
context.setVariable("totalHits", docs.totalHits);
} else {
context.setVariable("totalHits", null);
}
context.setVariable((indexName + ".totalHits").replace(".", "_"), docs.totalHits);
}
}
示例3: executeIndexQuery
import com.orientechnologies.orient.core.command.OCommandContext; //导入方法依赖的package包/类
@Override
public OIndexCursor executeIndexQuery(OCommandContext iContext, OIndex<?> index, List<Object> keyParams, boolean ascSortOrder) {
OIndexCursor cursor;
OIndexDefinition definition = index.getDefinition();
int idxSize = definition.getFields().size();
int paramsSize = keyParams.size();
double distance = 0;
Object spatial = iContext.getVariable("spatial");
if (spatial != null) {
if (spatial instanceof Number) {
distance = ((Double) OType.convert(spatial, Double.class)).doubleValue();
} else if (spatial instanceof Map) {
Map<String, Object> params = (Map<String, Object>) spatial;
Object dst = params.get("maxDistance");
if (dst != null && dst instanceof Number) {
distance = ((Double) OType.convert(dst, Double.class)).doubleValue();
}
}
}
Object indexResult = index.get(new OSpatialCompositeKey(keyParams).setMaxDistance(distance).setContext(iContext));
if (indexResult == null || indexResult instanceof OIdentifiable)
cursor = new OIndexCursorSingleValue((OIdentifiable) indexResult, new OSpatialCompositeKey(keyParams));
else
cursor = new OIndexCursorCollectionValue(((Collection<OIdentifiable>) indexResult).iterator(), new OSpatialCompositeKey(
keyParams));
iContext.setVariable("$luceneIndex", true);
return cursor;
}