protected internal override System.Object CreateValue(IndexReader reader, Entry entryKey) { Entry entry = (Entry)entryKey; System.String field = entry.field; SortComparator comparator = (SortComparator)entry.custom; System.IComparable[] retArray = new System.IComparable[reader.MaxDoc()]; 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; } System.IComparable termval = comparator.GetComparable(term.Text()); termDocs.Seek(termEnum); while (termDocs.Next()) { retArray[termDocs.Doc()] = termval; } }while (termEnum.Next()); } finally { termDocs.Close(); termEnum.Close(); } return(retArray); }
private void InitBlock(System.IComparable[] cachedValues, SortComparator enclosingInstance) { this.cachedValues = cachedValues; this.enclosingInstance = enclosingInstance; }
public AnonymousClassScoreDocComparator(System.IComparable[] cachedValues, SortComparator enclosingInstance) { InitBlock(cachedValues, enclosingInstance); }
public virtual System.IComparable[] GetCustom(IndexReader reader, System.String field, SortComparator comparator) { return((System.IComparable[])((Cache)caches[typeof(System.IComparable)]).Get(reader, new Entry(field, comparator))); }
public virtual System.IComparable[] GetCustom(IndexReader reader, System.String field, SortComparator comparator) { return (System.IComparable[]) ((Cache) caches[typeof(System.IComparable)]).Get(reader, new Entry(field, comparator)); }