当前位置: 首页>>代码示例>>Java>>正文


Java OCommandContext.getVariable方法代码示例

本文整理汇总了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;
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:33,代码来源:OLuceneNearOperator.java

示例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);
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-lucene,代码行数:12,代码来源:OLuceneIndexManagerAbstract.java

示例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;
}
 
开发者ID:orientechnologies,项目名称:orientdb-lucene,代码行数:33,代码来源:OLuceneNearOperator.java


注:本文中的com.orientechnologies.orient.core.command.OCommandContext.getVariable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。