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


Java NumericUtils.intToPrefixCoded方法代码示例

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


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

示例1: normalizeFieldValue

import org.apache.lucene.util.NumericUtils; //导入方法依赖的package包/类
public String normalizeFieldValue(String field, Object value) {
  if (NumberUtils.isNumber(value.toString())) {
    Number n = NumberUtils.createNumber(value.toString());
    if (n instanceof Integer)
      return NumericUtils.intToPrefixCoded((Integer) n);
    else if (n instanceof Long)
      return NumericUtils.longToPrefixCoded((Long) n);
    else if (n instanceof Float)
      return NumericUtils.floatToPrefixCoded((Float) n);
    else if (n instanceof Double)
      return NumericUtils.doubleToPrefixCoded((Double) n);
    else
      throw new IllegalArgumentException("Unhandled numeric type: " + n.getClass());
  } else {
    throw new IllegalArgumentException("Value is not a number: " + value);
  }
}
 
开发者ID:apache,项目名称:accumulo-wikisearch,代码行数:18,代码来源:NumberNormalizer.java

示例2: term

import org.apache.lucene.util.NumericUtils; //导入方法依赖的package包/类
@Override
public BytesRef term(Float value) {
    int intValue = NumericUtils.floatToSortableInt(value);
    BytesRefBuilder bytesRef = new BytesRefBuilder();
    NumericUtils.intToPrefixCoded(intValue, 0, bytesRef);
    return bytesRef.get();
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:8,代码来源:TermBuilder.java

示例3: indexedValueForSearch

import org.apache.lucene.util.NumericUtils; //导入方法依赖的package包/类
@Override
public BytesRef indexedValueForSearch(Object value) {
    int intValue = NumericUtils.floatToSortableInt(parseValue(value));
    BytesRefBuilder bytesRef = new BytesRefBuilder();
    NumericUtils.intToPrefixCoded(intValue, 0, bytesRef);   // 0 because of exact match
    return bytesRef.get();
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:8,代码来源:FloatFieldMapper.java

示例4: updateDocument

import org.apache.lucene.util.NumericUtils; //导入方法依赖的package包/类
@Override
public boolean updateDocument(ShopDTO shopDTO) {

    Document document = buildDucument(shopDTO);

    BytesRefBuilder bytes = new BytesRefBuilder();
    NumericUtils.intToPrefixCoded(shopDTO.getShopid(), 0, bytes);
    Term term = new Term(ShopDTO.ShopParam.SHOP_ID, bytes);

    boolean ret = LuceneUtil.updateDocument(term, document);
    return ret;
}
 
开发者ID:xuxueli,项目名称:xxl-search,代码行数:13,代码来源:LuceneSearchServiceImpl.java

示例5: deleteDocument

import org.apache.lucene.util.NumericUtils; //导入方法依赖的package包/类
@Override
public boolean deleteDocument(int shopid) {
    BytesRefBuilder bytes = new BytesRefBuilder();
    NumericUtils.intToPrefixCoded(shopid, 0, bytes);
    Term term = new Term(ShopDTO.ShopParam.SHOP_ID, bytes);

    boolean ret = LuceneUtil.deleteDocument(term);
    return ret;
}
 
开发者ID:xuxueli,项目名称:xxl-search,代码行数:10,代码来源:LuceneSearchServiceImpl.java

示例6: readableToIndexed

import org.apache.lucene.util.NumericUtils; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void readableToIndexed(CharSequence val, BytesRef result) {
  final String s = val.toString();
  if (s == null)
    return;

  final Integer intValue = stringValueToIntValue(s);
  BytesRefBuilder b = new BytesRefBuilder();
  NumericUtils.intToPrefixCoded(intValue, 0, b);
  result.copyBytes(b.get());
}
 
开发者ID:europeana,项目名称:search,代码行数:15,代码来源:EnumField.java

示例7: storedToIndexed

import org.apache.lucene.util.NumericUtils; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public String storedToIndexed(IndexableField f) {
  final Number val = f.numericValue();
  if (val == null)
    return null;
  final BytesRefBuilder bytes = new BytesRefBuilder();
  NumericUtils.intToPrefixCoded(val.intValue(), 0, bytes);
  return bytes.get().utf8ToString();
}
 
开发者ID:europeana,项目名称:search,代码行数:13,代码来源:EnumField.java

示例8: newTermQuery

import org.apache.lucene.util.NumericUtils; //导入方法依赖的package包/类
protected Query newTermQuery(Term term) {
if (InformationAssetViewFields.SOURCE.toString().equals(term.field())) {

    BytesRefBuilder byteRefBuilder = new BytesRefBuilder();
    NumericUtils.intToPrefixCoded(Integer.parseInt(term.text()), 0, byteRefBuilder);
    TermQuery tq = new TermQuery(new Term(term.field(), byteRefBuilder.get()));

    return tq;
}
return super.newTermQuery(term);
   }
 
开发者ID:nationalarchives,项目名称:taxonomy,代码行数:12,代码来源:TaxonomyQueryParser.java

示例9: getSourceFilterForValue

import org.apache.lucene.util.NumericUtils; //导入方法依赖的package包/类
private Query getSourceFilterForValue(String sourceValue) {
       Integer intCatalogueSourceValue = Integer.valueOf(sourceValue);
BytesRefBuilder bytes = new BytesRefBuilder();
NumericUtils.intToPrefixCoded(intCatalogueSourceValue, 0, bytes);
TermQuery termFilter = new TermQuery(new Term(InformationAssetViewFields.SOURCE.toString(), bytes.get()));
return termFilter;
   }
 
开发者ID:nationalarchives,项目名称:taxonomy,代码行数:8,代码来源:LuceneIAViewConfiguration.java

示例10: readableToIndexed

import org.apache.lucene.util.NumericUtils; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void readableToIndexed(CharSequence val, BytesRef result) {
  final String s = val.toString();
  if (s == null)
    return;

  final Integer intValue = stringValueToIntValue(s);
  NumericUtils.intToPrefixCoded(intValue, 0, result);
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:13,代码来源:EnumField.java

示例11: storedToIndexed

import org.apache.lucene.util.NumericUtils; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public String storedToIndexed(IndexableField f) {
  final Number val = f.numericValue();
  if (val == null)
    return null;
  final BytesRef bytes = new BytesRef(NumericUtils.BUF_SIZE_LONG);
  NumericUtils.intToPrefixCoded(val.intValue(), 0, bytes);
  return bytes.utf8ToString();
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:13,代码来源:EnumField.java

示例12: indexedValueForSearch

import org.apache.lucene.util.NumericUtils; //导入方法依赖的package包/类
@Override
public BytesRef indexedValueForSearch(Object value) {
    BytesRefBuilder bytesRef = new BytesRefBuilder();
    NumericUtils.intToPrefixCoded(parseValue(value), 0, bytesRef);  // 0 because of exact match
    return bytesRef.get();
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:7,代码来源:ShortFieldMapper.java

示例13: indexedValueForSearch

import org.apache.lucene.util.NumericUtils; //导入方法依赖的package包/类
@Override
public BytesRef indexedValueForSearch(Object value) {
    BytesRefBuilder bytesRef = new BytesRefBuilder();
    NumericUtils.intToPrefixCoded(parseValue(value), 0, bytesRef); // 0 because of exact match
    return bytesRef.get();
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:7,代码来源:IntegerFieldMapper.java

示例14: next

import org.apache.lucene.util.NumericUtils; //导入方法依赖的package包/类
@Override
public BytesRef next() {
  BytesRefBuilder b = new BytesRefBuilder();
  NumericUtils.intToPrefixCoded((int) values.valueAt(this.count++), 0, b);
  return b.toBytesRef();
}
 
开发者ID:sirensolutions,项目名称:siren-join,代码行数:7,代码来源:BytesRefTermStream.java

示例15: intTerm

import org.apache.lucene.util.NumericUtils; //导入方法依赖的package包/类
static Term intTerm(String name, int value) {
  BytesRefBuilder builder = new BytesRefBuilder();
  NumericUtils.intToPrefixCoded(value, 0, builder);
  return new Term(name, builder.get());
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:6,代码来源:QueryBuilder.java


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