當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。