protected internal override System.Object CreateValue(IndexReader reader, Entry entryKey) { Entry entry = (Entry)entryKey; System.String field = entry.field; Lucene.Net.Search.LongParser parser = (Lucene.Net.Search.LongParser)entry.custom; if (parser == null) { try { return(wrapper.GetLongs(reader, field, Lucene.Net.Search.FieldCache_Fields.DEFAULT_LONG_PARSER)); } catch (System.FormatException ne) { return(wrapper.GetLongs(reader, field, Lucene.Net.Search.FieldCache_Fields.NUMERIC_UTILS_LONG_PARSER)); } } long[] retArray = null; TermDocs termDocs = reader.TermDocs(); TermEnum termEnum = reader.Terms(new Term(field)); try { do { Term term = termEnum.Term(); if (term == null || (System.Object)term.Field() != (System.Object)field) { break; } long termval = parser.ParseLong(term.Text()); if (retArray == null) { // late init retArray = new long[reader.MaxDoc()]; } termDocs.Seek(termEnum); while (termDocs.Next()) { retArray[termDocs.Doc()] = termval; } }while (termEnum.Next()); } catch (StopFillCacheException stop) { } finally { termDocs.Close(); termEnum.Close(); } if (retArray == null) { // no values retArray = new long[reader.MaxDoc()]; } return(retArray); }
/// <summary> Creates a numeric range query using {@link FieldCache#GetLongs(IndexReader,String,FieldCache.LongParser)}. This works with all /// long fields containing exactly one numeric term in the field. The range can be half-open by setting one /// of the values to <code>null</code>. /// </summary> public static FieldCacheRangeFilter NewLongRange(System.String field, Lucene.Net.Search.LongParser parser, System.ValueType lowerVal, System.ValueType upperVal, bool includeLower, bool includeUpper) { return(new AnonymousClassFieldCacheRangeFilter4(field, parser, lowerVal, upperVal, includeLower, includeUpper)); }
/// <summary> Returns a comparator for sorting hits according to a field containing integers.</summary> /// <param name="reader"> Index to use. /// </param> /// <param name="fieldname"> Fieldable containing integer values. /// </param> /// <returns> Comparator for sorting hits. /// </returns> /// <throws> IOException If an error occurs reading the index. </throws> internal static ScoreDocComparator comparatorLong(IndexReader reader, System.String fieldname, Lucene.Net.Search.LongParser parser) { System.String field = String.Intern(fieldname); long[] fieldOrder = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetLongs(reader, field, parser); return(new AnonymousClassScoreDocComparator3(fieldOrder)); }
internal LongComparator(int numHits, System.String field, Lucene.Net.Search.Parser parser) { values = new long[numHits]; this.field = field; this.parser = (LongParser)parser; }
// inherit javadocs public virtual long[] GetLongs(IndexReader reader, System.String field, Lucene.Net.Search.LongParser parser) { return((long[])((Cache)caches[System.Type.GetType("System.Int64")]).Get(reader, new Entry(field, parser))); }
/// <summary> Creates a numeric range query using <see cref="FieldCache.GetLongs(IndexReader,String,LongParser)" />. This works with all /// long fields containing exactly one numeric term in the field. The range can be half-open by setting one /// of the values to <c>null</c>. /// </summary> public static FieldCacheRangeFilter <long?> NewLongRange(string field, Lucene.Net.Search.LongParser parser, long?lowerVal, long?upperVal, bool includeLower, bool includeUpper) { return(new AnonymousClassFieldCacheRangeFilter4(field, parser, lowerVal, upperVal, includeLower, includeUpper)); }
internal LongComparator(int numHits, System.String field, Lucene.Net.Search.Parser parser) { values = new long[numHits]; this.field = field; this.parser = (LongParser) parser; }
// inherit javadocs public virtual long[] GetLongs(IndexReader reader, System.String field, Lucene.Net.Search.LongParser parser) { return((long[])caches[typeof(long)].Get(reader, new Entry(field, parser))); }
// inherit javadocs public virtual long[] GetLongs(IndexReader reader, System.String field, Lucene.Net.Search.LongParser parser, IState state) { return(_longCache.Get(reader, new Entry(field, parser), state)); }