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


Java FieldInvertState类代码示例

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


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

示例1: getNormValues

import org.apache.lucene.index.FieldInvertState; //导入依赖的package包/类
@Override
public NumericDocValues getNormValues(String field) {
  FieldInfo fieldInfo = fieldInfos.get(field);
  if (fieldInfo == null || fieldInfo.omitsNorms())
    return null;
  NumericDocValues norms = cachedNormValues;
  Similarity sim = getSimilarity();
  if (!field.equals(cachedFieldName) || sim != cachedSimilarity) { // not cached?
    Info info = getInfo(field);
    int numTokens = info != null ? info.numTokens : 0;
    int numOverlapTokens = info != null ? info.numOverlapTokens : 0;
    float boost = info != null ? info.getBoost() : 1.0f; 
    FieldInvertState invertState = new FieldInvertState(field, 0, numTokens, numOverlapTokens, 0, boost);
    long value = sim.computeNorm(invertState);
    norms = new MemoryIndexNormDocValues(value);
    // cache it for future reuse
    cachedNormValues = norms;
    cachedFieldName = field;
    cachedSimilarity = sim;
    if (DEBUG) System.err.println("MemoryIndexReader.norms: " + field + ":" + value + ":" + numTokens);
  }
  return norms;
}
 
开发者ID:europeana,项目名称:search,代码行数:24,代码来源:MemoryIndex.java

示例2: computeNorm

import org.apache.lucene.index.FieldInvertState; //导入依赖的package包/类
/** Encodes the document length in the same way as {@link TFIDFSimilarity}. */
@Override
public long computeNorm(FieldInvertState state) {
  final float numTerms;
  if (discountOverlaps)
    numTerms = state.getLength() - state.getNumOverlap();
  else
    numTerms = state.getLength();
  return encodeNormValue(state.getBoost(), numTerms);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:SimilarityBase.java

示例3: lengthNorm

import org.apache.lucene.index.FieldInvertState; //导入依赖的package包/类
/** Implemented as
 *  <code>state.getBoost()*lengthNorm(numTerms)</code>, where
 *  <code>numTerms</code> is {@link FieldInvertState#getLength()} if {@link
 *  #setDiscountOverlaps} is false, else it's {@link
 *  FieldInvertState#getLength()} - {@link
 *  FieldInvertState#getNumOverlap()}.
 *
 *  @lucene.experimental */
@Override
public float lengthNorm(FieldInvertState state) {
  final int numTerms;
  if (discountOverlaps)
    numTerms = state.getLength() - state.getNumOverlap();
  else
    numTerms = state.getLength();
  return state.getBoost() * ((float) (1.0 / Math.sqrt(numTerms)));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:DefaultSimilarity.java

示例4: computeNorm

import org.apache.lucene.index.FieldInvertState; //导入依赖的package包/类
@Override
public final long computeNorm(FieldInvertState state) {
  final float numTerms = discountOverlaps ? state.getLength() - state.getNumOverlap() : state.getLength();
  // Dividing by the square of the boost is to mimic behavior of the old BM25 formula
  final float boost = state.getBoost();
  return (long) ( numTerms / (boost*boost) );
}
 
开发者ID:sebastian-hofstaetter,项目名称:ir-generalized-translation-models,代码行数:8,代码来源:BM25SimilarityLossless.java

示例5: lengthNorm

import org.apache.lucene.index.FieldInvertState; //导入依赖的package包/类
/** Implemented as
 *  <code>state.getBoost()*lengthNorm(numTerms)</code>, where
 *  <code>numTerms</code> is {@link org.apache.lucene.index.FieldInvertState#getLength()} if {@link
 *  #setDiscountOverlaps} is false, else it's {@link
 *  org.apache.lucene.index.FieldInvertState#getLength()} - {@link
 *  org.apache.lucene.index.FieldInvertState#getNumOverlap()}.
 *
 *  @lucene.experimental */
@Override
public float lengthNorm(FieldInvertState state) {
  final int numTerms;
  if (discountOverlaps)
    numTerms = state.getLength() - state.getNumOverlap();
  else
    numTerms = state.getLength();
  return state.getBoost() * ((float) (1.0 / Math.sqrt(numTerms)));
}
 
开发者ID:XiaoMi,项目名称:linden,代码行数:18,代码来源:LindenSimilarity.java

示例6: lengthNorm

import org.apache.lucene.index.FieldInvertState; //导入依赖的package包/类
/** Implemented as
 *  <code>state.getBoost()*lengthNorm(numTerms)</code>, where
 *  <code>numTerms</code> is {@link org.apache.lucene.index.FieldInvertState#getLength()} if {@link
 *  #setDiscountOverlaps} is false, else it's {@link
 *  org.apache.lucene.index.FieldInvertState#getLength()} - {@link
 *  org.apache.lucene.index.FieldInvertState#getNumOverlap()}.
 *
 *  @lucene.experimental */
@Override
public float lengthNorm(FieldInvertState state) {
  final int numTerms;
  if (discountOverlaps) {
    numTerms = state.getLength() - state.getNumOverlap();
  } else {
    numTerms = state.getLength();
  }
  return state.getBoost() * ((float) (1.0 / Math.sqrt(numTerms)));
}
 
开发者ID:europeana,项目名称:search,代码行数:19,代码来源:TestLongNormValueSource.java

示例7: lengthNorm

import org.apache.lucene.index.FieldInvertState; //导入依赖的package包/类
/**
 * Implemented as <code> state.getBoost() *
 * computeLengthNorm(numTokens) </code> where
 * numTokens does not count overlap tokens if
 * discountOverlaps is true by default or true for this
 * specific field. 
 */
@Override
public float lengthNorm(FieldInvertState state) {
  final int numTokens;

  if (discountOverlaps)
    numTokens = state.getLength() - state.getNumOverlap();
  else
    numTokens = state.getLength();

  return state.getBoost() * computeLengthNorm(numTokens);
}
 
开发者ID:europeana,项目名称:search,代码行数:19,代码来源:SweetSpotSimilarity.java

示例8: computeNorm

import org.apache.lucene.index.FieldInvertState; //导入依赖的package包/类
@Override
public long computeNorm(FieldInvertState state) {
  if (state.getName().equals(NORMS_FIELD)) {
    return Float.floatToIntBits(state.getBoost());
  } else {
    return in.computeNorm(state);
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:9,代码来源:SorterTestBase.java

示例9: testDiscountOverlapsBoost

import org.apache.lucene.index.FieldInvertState; //导入依赖的package包/类
public void testDiscountOverlapsBoost() throws IOException {
  DefaultSimilarity expected = new DefaultSimilarity();
  SimilarityBase actual = new DFRSimilarity(new BasicModelIne(), new AfterEffectB(), new NormalizationH2());
  expected.setDiscountOverlaps(false);
  actual.setDiscountOverlaps(false);
  FieldInvertState state = new FieldInvertState("foo");
  state.setLength(5);
  state.setNumOverlap(2);
  state.setBoost(3);
  assertEquals(expected.computeNorm(state), actual.computeNorm(state));
  expected.setDiscountOverlaps(true);
  actual.setDiscountOverlaps(true);
  assertEquals(expected.computeNorm(state), actual.computeNorm(state));
}
 
开发者ID:europeana,项目名称:search,代码行数:15,代码来源:TestSimilarityBase.java

示例10: lengthNorm

import org.apache.lucene.index.FieldInvertState; //导入依赖的package包/类
/** Implemented as
 *  <code>state.getBoost()*lengthNorm(numTerms)</code>, where
 *  <code>numTerms</code> is {@link FieldInvertState#getLength()} if {@link
 *  #setDiscountOverlaps} is false, else it's {@link
 *  FieldInvertState#getLength()} - {@link
 *  FieldInvertState#getNumOverlap()}.
 *
 *  @lucene.experimental */
@Override
public float lengthNorm(FieldInvertState state) {
    final int numTerms;
    if (discountOverlaps)
        numTerms = state.getLength() - state.getNumOverlap();
    else
        numTerms = state.getLength();
    return state.getBoost() * ((float) (1.0 / Math.sqrt(numTerms)));
}
 
开发者ID:DiceTechJobs,项目名称:SolrPlugins,代码行数:18,代码来源:DiceDefaultSimilarity.java

示例11: computeNorm

import org.apache.lucene.index.FieldInvertState; //导入依赖的package包/类
/** Encodes the document length in the same way as {@link TFIDFSimilarity}. */
@Override
public long computeNorm(FieldInvertState state) {
  final float numTerms;
  if (discountOverlaps)
    numTerms = state.getLength() - state.getNumOverlap();
  else
    numTerms = state.getLength() / state.getBoost();
  return encodeNormValue(state.getBoost(), numTerms);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:11,代码来源:SimilarityBase.java

示例12: lengthNorm

import org.apache.lucene.index.FieldInvertState; //导入依赖的package包/类
/** Implemented as
 *  <code>state.getBoost()*lengthNorm(numTerms)</code>, where
 *  <code>numTerms</code> is {@link FieldInvertState#getLength()} if {@link
 *  #setDiscountOverlaps} is false, else it's {@link
 *  FieldInvertState#getLength()} - {@link
 *  FieldInvertState#getNumOverlap()}.
 *
 *  @lucene.experimental */
@Override
public float lengthNorm(FieldInvertState state) {
  final int numTerms;
  if (discountOverlaps)
    numTerms = state.getLength() - state.getNumOverlap();
  else
    numTerms = state.getLength();
 return state.getBoost() * ((float) (1.0 / Math.sqrt(numTerms)));
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:18,代码来源:DefaultSimilarity.java

示例13: computeNorm

import org.apache.lucene.index.FieldInvertState; //导入依赖的package包/类
@Override
final public float computeNorm(String field, FieldInvertState state) {
	final int numTerms;
	if (discountOverlaps)
		numTerms = state.getLength() - state.getNumOverlap();
	else
		numTerms = state.getLength();
	return state.getBoost() * ((float) (1.0 / numTerms));
}
 
开发者ID:jaeksoft,项目名称:opensearchserver,代码行数:10,代码来源:FairSimilarity.java

示例14: computeNorm

import org.apache.lucene.index.FieldInvertState; //导入依赖的package包/类
@Override
public long computeNorm(FieldInvertState state) {
    return delegate.computeNorm(state);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:IndexModuleTests.java

示例15: computeNorm

import org.apache.lucene.index.FieldInvertState; //导入依赖的package包/类
@Override
public final long computeNorm(FieldInvertState state) {
  final int numTerms = discountOverlaps ? state.getLength() - state.getNumOverlap() : state.getLength();
  return encodeNormValue(state.getBoost(), numTerms);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:6,代码来源:BM25Similarity.java


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