org.apache.lucene.search.FieldCache源码实例Demo

类org.apache.lucene.search.FieldCache源码实例Demo

下面列出了org.apache.lucene.search.FieldCache 类实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: linden   文件: LindenUtil.java
private static boolean actualContain(AtomicReader reader, String field, int locDocId) {
  try {
    // index really contains such field of this doc
    return FieldCache.DEFAULT.getDocsWithField(reader, field).get(locDocId);
  } catch (IOException e) {
    return false;
  }
}
 
private void buildFieldMap( ResponseBuilder rb ) throws IOException {
  Log.debug( "buildFieldMap" );
  SolrIndexSearcher searcher = rb.req.getSearcher();
  // build a synonym map from the SortedDocValues -
  // for each field value: lower case, stemmed, lookup synonyms from synonyms.txt - map to fieldValue
  SynonymMap.Builder fieldBuilder = new SynonymMap.Builder( true );
  SynonymMap.Builder termBuilder = new SynonymMap.Builder( true );
    
  ArrayList<String> searchFields = getStringFields( searcher );

  for (String searchField : searchFields ) {
    Log.debug( "adding searchField " + searchField );
    CharsRef fieldChars = new CharsRef( searchField );
    SortedSetDocValues sdv = FieldCache.DEFAULT.getDocTermOrds( searcher.getAtomicReader( ), searchField );
    if (sdv == null) continue;
    Log.debug( "got SortedSetDocValues for " + searchField );
    TermsEnum te = sdv.termsEnum();
    while (te.next() != null) {
      BytesRef term = te.term();
      String fieldValue = term.utf8ToString( );
      addTerm ( fieldChars, fieldValue, fieldBuilder, termBuilder );
    }
  }
    
  addDistributedTerms( rb, fieldBuilder, termBuilder, searchFields );
    
  fieldMap = fieldBuilder.build( );
  termMap = termBuilder.build( );
}
 
源代码3 项目: BioSolr   文件: XJoinValueSourceParser.java
@Override
@SuppressWarnings("rawtypes")
public FunctionValues getValues(Map context, AtomicReaderContext readerContext) throws IOException {
  final BinaryDocValues joinValues = FieldCache.DEFAULT.getTerms(readerContext.reader(), joinField, false);

  return new DoubleDocValues(this) {

    @Override
    public double doubleVal(int doc) {
      BytesRef joinValue = joinValues.get(doc);
      if (joinValue == null) {
        throw new RuntimeException("No such doc: " + doc);
      }
      Object result = results.getResult(joinValue.utf8ToString());
      if (result == null) {
        return defaultValue;
      }
      if (result instanceof Iterable) {
        Double max = null;
        for (Object object : (Iterable)result) {
          if (object != null) {
            double value = getValue(object);
            if (max == null || value > max) {
              max = value;
            }
          }
        }
        return max != null ? max : defaultValue;
      } else {
        return getValue(result);
      }
    }
    
  };
}
 
源代码4 项目: linden   文件: LindenFieldCacheImpl.java
@Override
public Bits getDocsWithField(AtomicReader reader, String field) throws IOException {
  return FieldCache.DEFAULT.getDocsWithField(reader, field);
}
 
源代码5 项目: linden   文件: LindenFieldCacheImpl.java
@Override
public Bytes getBytes(AtomicReader reader, String field, boolean setDocsWithField) throws IOException {
  return FieldCache.DEFAULT.getBytes(reader, field, setDocsWithField);
}
 
源代码6 项目: linden   文件: LindenFieldCacheImpl.java
@Override
public Bytes getBytes(AtomicReader reader, String field, ByteParser parser, boolean setDocsWithField)
    throws IOException {
  return FieldCache.DEFAULT.getBytes(reader, field, parser, setDocsWithField);
}
 
源代码7 项目: linden   文件: LindenFieldCacheImpl.java
@Override
public Shorts getShorts(AtomicReader reader, String field, boolean setDocsWithField) throws IOException {
  return FieldCache.DEFAULT.getShorts(reader, field, setDocsWithField);
}
 
源代码8 项目: linden   文件: LindenFieldCacheImpl.java
@Override
public Shorts getShorts(AtomicReader reader, String field, ShortParser parser, boolean setDocsWithField)
    throws IOException {
  return FieldCache.DEFAULT.getShorts(reader, field, parser, setDocsWithField);
}
 
源代码9 项目: linden   文件: LindenFieldCacheImpl.java
@Override
public Ints getInts(AtomicReader reader, String field, boolean setDocsWithField) throws IOException {
  return FieldCache.DEFAULT.getInts(reader, field, setDocsWithField);
}
 
源代码10 项目: linden   文件: LindenFieldCacheImpl.java
@Override
public Ints getInts(AtomicReader reader, String field, IntParser parser, boolean setDocsWithField)
    throws IOException {
  return FieldCache.DEFAULT.getInts(reader, field, parser, setDocsWithField);
}
 
源代码11 项目: linden   文件: LindenFieldCacheImpl.java
@Override
public Floats getFloats(AtomicReader reader, String field, boolean setDocsWithField) throws IOException {
  return FieldCache.DEFAULT.getFloats(reader, field, setDocsWithField);
}
 
源代码12 项目: linden   文件: LindenFieldCacheImpl.java
@Override
public Floats getFloats(AtomicReader reader, String field, FloatParser parser, boolean setDocsWithField)
    throws IOException {
  return FieldCache.DEFAULT.getFloats(reader, field, parser, setDocsWithField);
}
 
源代码13 项目: linden   文件: LindenFieldCacheImpl.java
@Override
public Longs getLongs(AtomicReader reader, String field, boolean setDocsWithField) throws IOException {
  return FieldCache.DEFAULT.getLongs(reader, field, setDocsWithField);
}
 
源代码14 项目: linden   文件: LindenFieldCacheImpl.java
@Override
public Longs getLongs(AtomicReader reader, String field, LongParser parser, boolean setDocsWithField)
    throws IOException {
  return FieldCache.DEFAULT.getLongs(reader, field, parser, setDocsWithField);
}
 
源代码15 项目: linden   文件: LindenFieldCacheImpl.java
@Override
public Doubles getDoubles(AtomicReader reader, String field, boolean setDocsWithField) throws IOException {
  return FieldCache.DEFAULT.getDoubles(reader, field, setDocsWithField);
}
 
源代码16 项目: linden   文件: LindenFieldCacheImpl.java
@Override
public Doubles getDoubles(AtomicReader reader, String field, DoubleParser parser, boolean setDocsWithField)
    throws IOException {
  return FieldCache.DEFAULT.getDoubles(reader, field, parser, setDocsWithField);
}
 
源代码17 项目: linden   文件: LindenFieldCacheImpl.java
@Override
public BinaryDocValues getTerms(AtomicReader reader, String field, boolean setDocsWithField) throws IOException {
  return FieldCache.DEFAULT.getTerms(reader, field, setDocsWithField);
}
 
源代码18 项目: linden   文件: LindenFieldCacheImpl.java
@Override
public BinaryDocValues getTerms(AtomicReader reader, String field, boolean setDocsWithField,
                                float acceptableOverheadRatio) throws IOException {
  return FieldCache.DEFAULT.getTerms(reader, field, setDocsWithField, acceptableOverheadRatio);
}
 
源代码19 项目: linden   文件: LindenFieldCacheImpl.java
@Override
public SortedDocValues getTermsIndex(AtomicReader reader, String field) throws IOException {
  return FieldCache.DEFAULT.getTermsIndex(reader, field);
}
 
源代码20 项目: linden   文件: LindenFieldCacheImpl.java
@Override
public SortedDocValues getTermsIndex(AtomicReader reader, String field, float acceptableOverheadRatio)
    throws IOException {
  return FieldCache.DEFAULT.getTermsIndex(reader, field, acceptableOverheadRatio);
}
 
源代码21 项目: linden   文件: LindenFieldCacheImpl.java
@Override
public SortedSetDocValues getDocTermOrds(AtomicReader reader, String field) throws IOException {
  return FieldCache.DEFAULT.getDocTermOrds(reader, field);
}
 
源代码22 项目: linden   文件: LindenScoreModelStrategy.java
public IntsWrapper(String field, AtomicReader reader) throws IOException {
  ints = FieldCache.DEFAULT.getInts(reader, field, false);
}
 
源代码23 项目: linden   文件: LindenScoreModelStrategy.java
public LongsWrapper(String field, AtomicReader reader) throws IOException {
  longs = FieldCache.DEFAULT.getLongs(reader, field, false);
}
 
源代码24 项目: linden   文件: LindenScoreModelStrategy.java
public DoublesWrapper(String field, AtomicReader reader) throws IOException {
  doubles = FieldCache.DEFAULT.getDoubles(reader, field, false);
}
 
源代码25 项目: linden   文件: LindenScoreModelStrategy.java
public FloatsWrapper(String field, AtomicReader reader) throws IOException {
  floats = FieldCache.DEFAULT.getFloats(reader, field, false);
}
 
源代码26 项目: linden   文件: LindenScoreModelStrategy.java
public IndexedStringsWrapper(String field, AtomicReader reader) throws IOException {
  values = FieldCache.DEFAULT.getTerms(reader, field, false);
}
 
源代码27 项目: linden   文件: LindenUtil.java
public static Float getFieldFloatValue(List<AtomicReaderContext> leaves, int docId, String fieldName)
    throws IOException {
  AtomicReaderContext atomicReaderContext = leaves.get(ReaderUtil.subIndex(docId, leaves));
  FieldCache.Floats floats = FieldCache.DEFAULT.getFloats(atomicReaderContext.reader(), fieldName, false);
  return floats.get(docId - atomicReaderContext.docBase);
}
 
源代码28 项目: linden   文件: LindenUtil.java
public static Double getFieldDoubleValue(List<AtomicReaderContext> leaves, int docId, String fieldName)
    throws IOException {
  AtomicReaderContext atomicReaderContext = leaves.get(ReaderUtil.subIndex(docId, leaves));
  FieldCache.Doubles doubles = FieldCache.DEFAULT.getDoubles(atomicReaderContext.reader(), fieldName, false);
  return doubles.get(docId - atomicReaderContext.docBase);
}
 
源代码29 项目: linden   文件: LindenUtil.java
public static String getFieldStringValue(List<AtomicReaderContext> leaves, int docId, String fieldName)
    throws IOException {
  AtomicReaderContext atomicReaderContext = leaves.get(ReaderUtil.subIndex(docId, leaves));
  BinaryDocValues terms = FieldCache.DEFAULT.getTerms(atomicReaderContext.reader(), fieldName, false);
  return terms.get(docId - atomicReaderContext.docBase).utf8ToString();
}
 
源代码30 项目: linden   文件: LindenUtil.java
public static Long getFieldLongValue(List<AtomicReaderContext> leaves, int docId, String fieldName)
    throws IOException {
  AtomicReaderContext atomicReaderContext = leaves.get(ReaderUtil.subIndex(docId, leaves));
  FieldCache.Longs longs = FieldCache.DEFAULT.getLongs(atomicReaderContext.reader(), fieldName, false);
  return longs.get(docId - atomicReaderContext.docBase);
}
 
如果文章对您有帮助,请点击页面广告。以鼓励作者做出的努力。
 类所在包
 类方法
 同包方法