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


Java SmallFloat类代码示例

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


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

示例1: payloadBoost

import org.apache.lucene.util.SmallFloat; //导入依赖的package包/类
float payloadBoost() throws IOException {
    if (doc != docID()) {
        final int freq = postings.freq();
        payloadBoost = 0;
        for (int i = 0; i < freq; ++i) {
            postings.nextPosition();
            final BytesRef payload = postings.getPayload();
            float boost;
            if (payload == null) {
                boost = 1;
            } else if (payload.length == 1) {
                boost = SmallFloat.byte315ToFloat(payload.bytes[payload.offset]);
            } else if (payload.length == 4) {
                // TODO: for bw compat only, remove this in 6.0
                boost = PayloadHelper.decodeFloat(payload.bytes, payload.offset);
            } else {
                throw new IllegalStateException("Payloads are expected to have a length of 1 or 4 but got: "
                    + payload);
            }
            payloadBoost += boost;
        }
        payloadBoost /= freq;
        doc = docID();
    }
    return payloadBoost;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:27,代码来源:AllTermQuery.java

示例2: collect

import org.apache.lucene.util.SmallFloat; //导入依赖的package包/类
@Override
public void collect(int doc) throws IOException {
    if (this.keyValues != null) {
        int value = (int) this.keyValues.get(doc);
        if (value > 0) {
            if (value >= this.scores.length) {
                this.scores = ScoreSuperCollector.resize(this.scores, (int) ((value + 1) * 1.25));
            }
            this.scores[value] = SmallFloat.floatToByte315(scorer.score());
        }
    }
}
 
开发者ID:seecr,项目名称:meresco-lucene,代码行数:13,代码来源:ScoreSuperCollector.java

示例3: AllTokenStream

import org.apache.lucene.util.SmallFloat; //导入依赖的package包/类
AllTokenStream(TokenStream input, float boost) {
    super(input);
    payloadAttribute = addAttribute(PayloadAttribute.class);
    payloadSpare.bytes[0] = SmallFloat.floatToByte315(boost);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:6,代码来源:AllTokenStream.java

示例4: encodeNormValue

import org.apache.lucene.util.SmallFloat; //导入依赖的package包/类
/** Encodes the length to a byte via SmallFloat. */
protected byte encodeNormValue(float boost, float length) {
  return SmallFloat.floatToByte315((boost / (float) Math.sqrt(length)));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:SimilarityBase.java

示例5: encodeNormValue

import org.apache.lucene.util.SmallFloat; //导入依赖的package包/类
@Override
protected byte encodeNormValue(float boost, int fieldLength) {
    return SmallFloat.floatToByte315(boost / (float) fieldLength);
}
 
开发者ID:sing1ee,项目名称:elasticsearch-similarity-plugin,代码行数:5,代码来源:SimpleSimilarity.java

示例6: encodeNormValue

import org.apache.lucene.util.SmallFloat; //导入依赖的package包/类
/** Encodes the length to a byte via SmallFloat. */
private static byte encodeNormValue(float boost, float length) {
    return SmallFloat.floatToByte315((boost / (float) Math.sqrt(length)));
}
 
开发者ID:sebastian-hofstaetter,项目名称:ir-generalized-translation-models,代码行数:5,代码来源:LeafReaderOverride.java

示例7: encodeNormValue

import org.apache.lucene.util.SmallFloat; //导入依赖的package包/类
/** Encodes a normalization factor for storage in an index. */
public final long encodeNormValue(final float floatVal) {
	return SmallFloat.floatToByte315(floatVal);
}
 
开发者ID:quhfus,项目名称:DoSeR-Disambiguation,代码行数:5,代码来源:FuzzyLabelSimilarity.java

示例8: score

import org.apache.lucene.util.SmallFloat; //导入依赖的package包/类
public float score(int key) {
    if (key < this.scores.length) {
        return SmallFloat.byte315ToFloat(this.scores[key]);
    }
    return 0;
}
 
开发者ID:seecr,项目名称:meresco-lucene,代码行数:7,代码来源:ScoreSuperCollector.java

示例9: encodeNormValue

import org.apache.lucene.util.SmallFloat; //导入依赖的package包/类
/**
 * Encodes a normalization factor for storage in an index.
 * <p>
 * The encoding uses a three-bit mantissa, a five-bit exponent, and the
 * zero-exponent point at 15, thus representing values from around 7x10^9 to
 * 2x10^-9 with about one significant decimal digit of accuracy. Zero is also
 * represented. Negative numbers are rounded up to zero. Values too large to
 * represent are rounded down to the largest representable value. Positive
 * values too small to represent are rounded up to the smallest positive
 * representable value.
 * 
 * @see org.apache.lucene.document.Field#setBoost(float)
 * @see org.apache.lucene.util.SmallFloat
 */
@Override
public final long encodeNormValue(float f) {
  return SmallFloat.floatToByte315(f);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:DefaultSimilarity.java

示例10: encodeNormValue

import org.apache.lucene.util.SmallFloat; //导入依赖的package包/类
/** The default implementation encodes <code>boost / sqrt(length)</code>
 * with {@link SmallFloat#floatToByte315(float)}.  This is compatible with 
 * Lucene's default implementation.  If you change this, then you should 
 * change {@link #decodeNormValue(byte)} to match. */
protected byte encodeNormValue(float boost, int fieldLength) {
  return SmallFloat.floatToByte315(boost / (float) Math.sqrt(fieldLength));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:BM25Similarity.java

示例11: encodeNormValue

import org.apache.lucene.util.SmallFloat; //导入依赖的package包/类
/**
 * Encodes a normalization factor for storage in an index.
 * <p>
 * The encoding uses a three-bit mantissa, a five-bit exponent, and the
 * zero-exponent point at 15, thus representing values from around 7x10^9 to
 * 2x10^-9 with about one significant decimal digit of accuracy. Zero is also
 * represented. Negative numbers are rounded up to zero. Values too large to
 * represent are rounded down to the largest representable value. Positive
 * values too small to represent are rounded up to the smallest positive
 * representable value.
 *
 * @see org.apache.lucene.document.Field#setBoost(float)
 * @see org.apache.lucene.util.SmallFloat
 */
@Override
public final long encodeNormValue(float f) {
  return SmallFloat.floatToByte315(f);
}
 
开发者ID:XiaoMi,项目名称:linden,代码行数:19,代码来源:LindenSimilarity.java

示例12: encodeNormValue

import org.apache.lucene.util.SmallFloat; //导入依赖的package包/类
/**
 * Encodes a normalization factor for storage in an index.
 * <p>
 * The encoding uses a three-bit mantissa, a five-bit exponent, and the
 * zero-exponent point at 15, thus representing values from around 7x10^9 to
 * 2x10^-9 with about one significant decimal digit of accuracy. Zero is also
 * represented. Negative numbers are rounded up to zero. Values too large to
 * represent are rounded down to the largest representable value. Positive
 * values too small to represent are rounded up to the smallest positive
 * representable value.
 *
 * @see org.apache.lucene.document.Field#setBoost(float)
 * @see org.apache.lucene.util.SmallFloat
 */
@Override
public long encodeNormValue(float f) {
    return SmallFloat.floatToByte315(f);
}
 
开发者ID:DiceTechJobs,项目名称:SolrPlugins,代码行数:19,代码来源:DiceDefaultSimilarity.java

示例13: encodeNormValue

import org.apache.lucene.util.SmallFloat; //导入依赖的package包/类
/** Encodes a normalization factor for storage in an index.
*
* <p>The encoding uses a three-bit mantissa, a five-bit exponent, and
* the zero-exponent point at 15, thus
* representing values from around 7x10^9 to 2x10^-9 with about one
* significant decimal digit of accuracy.  Zero is also represented.
* Negative numbers are rounded up to zero.  Values too large to represent
* are rounded down to the largest representable value.  Positive values too
* small to represent are rounded up to the smallest positive representable
* value.
* @see org.apache.lucene.document.Field#setBoost(float)
* @see org.apache.lucene.util.SmallFloat
*/
public byte encodeNormValue(float f) {
  return SmallFloat.floatToByte315(f);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:17,代码来源:TFIDFSimilarity.java

示例14: encodeNormValue

import org.apache.lucene.util.SmallFloat; //导入依赖的package包/类
/**
 * The default implementation encodes <code>boost / sqrt(length)</code> with {@link
 * SmallFloat#floatToByte315(float)}. This is compatible with Lucene's default implementation. If
 * you change this, then you should change {@link #decodeNormValue(byte)} to match.
 */
protected byte encodeNormValue(float boost, int fieldLength) {
  return SmallFloat.floatToByte315(boost / (float) Math.sqrt(fieldLength));
}
 
开发者ID:MysterionRise,项目名称:information-retrieval-adventure,代码行数:9,代码来源:BM25FSimilarity.java


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