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


Java ValueSource.createWeight方法代码示例

本文整理汇总了Java中org.apache.lucene.queries.function.ValueSource.createWeight方法的典型用法代码示例。如果您正苦于以下问题:Java ValueSource.createWeight方法的具体用法?Java ValueSource.createWeight怎么用?Java ValueSource.createWeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.lucene.queries.function.ValueSource的用法示例。


在下文中一共展示了ValueSource.createWeight方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getVersionFromIndex

import org.apache.lucene.queries.function.ValueSource; //导入方法依赖的package包/类
public Long getVersionFromIndex(BytesRef idBytes) {
  // TODO: we could cache much of this and invalidate during a commit.
  // TODO: most DocValues classes are threadsafe - expose which.

  RefCounted<SolrIndexSearcher> newestSearcher = ulog.uhandler.core.getRealtimeSearcher();
  try {
    SolrIndexSearcher searcher = newestSearcher.get();
    long lookup = searcher.lookupId(idBytes);
    if (lookup < 0) return null;

    ValueSource vs = versionField.getType().getValueSource(versionField, null);
    Map context = ValueSource.newContext(searcher);
    vs.createWeight(context, searcher);
    FunctionValues fv = vs.getValues(context, searcher.getTopReaderContext().leaves().get((int)(lookup>>32)));
    long ver = fv.longVal((int)lookup);
    return ver;

  } catch (IOException e) {
    throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Error reading version from index", e);
  } finally {
    if (newestSearcher != null) {
      newestSearcher.decref();
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:26,代码来源:VersionInfo.java

示例2: getStringVal

import org.apache.lucene.queries.function.ValueSource; //导入方法依赖的package包/类
private String getStringVal(SolrQueryRequest sqr, String field, int doc) throws IOException {
  SchemaField sf = sqr.getSchema().getField(field);
  ValueSource vs = sf.getType().getValueSource(sf, null);
  Map context = ValueSource.newContext(sqr.getSearcher());
  vs.createWeight(context, sqr.getSearcher());
  IndexReaderContext topReaderContext = sqr.getSearcher().getTopReaderContext();
  List<AtomicReaderContext> leaves = topReaderContext.leaves();
  int idx = ReaderUtil.subIndex(doc, leaves);
  AtomicReaderContext leaf = leaves.get(idx);
  FunctionValues vals = vs.getValues(context, leaf);
  return vals.strVal(doc-leaf.docBase);
}
 
开发者ID:europeana,项目名称:search,代码行数:13,代码来源:TestIndexSearcher.java

示例3: createWeight

import org.apache.lucene.queries.function.ValueSource; //导入方法依赖的package包/类
@Override
public void createWeight(Map context, IndexSearcher searcher) throws IOException {
  for (ValueSource source : sources)
    source.createWeight(context, searcher);
}
 
开发者ID:europeana,项目名称:search,代码行数:6,代码来源:VectorValueSource.java

示例4: createWeight

import org.apache.lucene.queries.function.ValueSource; //导入方法依赖的package包/类
@Override
public void createWeight(Map context, IndexSearcher searcher) throws IOException {
  for (ValueSource source : sources) {
    source.createWeight(context, searcher);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:7,代码来源:MultiBoolFunction.java


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