/// <summary>Creates a sort, possibly in reverse, by terms in the given field, parsed /// to numeric values using a custom {@link FieldCache.Parser}. /// </summary> /// <param name="field"> Name of field to sort by. Must not be null. /// </param> /// <param name="parser">Instance of a {@link FieldCache.Parser}, /// which must subclass one of the existing numeric /// parsers from {@link FieldCache}. Sort type is inferred /// by testing which numeric parser the parser subclasses. /// </param> /// <param name="reverse">True if natural order should be reversed. /// </param> /// <throws> IllegalArgumentException if the parser fails to </throws> /// <summary> subclass an existing numeric parser, or field is null /// </summary> public SortField(System.String field, Mono.Lucene.Net.Search.Parser parser, bool reverse) { if (parser is Mono.Lucene.Net.Search.IntParser) { InitFieldType(field, INT); } else if (parser is Mono.Lucene.Net.Search.FloatParser) { InitFieldType(field, FLOAT); } else if (parser is Mono.Lucene.Net.Search.ShortParser) { InitFieldType(field, SHORT); } else if (parser is Mono.Lucene.Net.Search.ByteParser) { InitFieldType(field, BYTE); } else if (parser is Mono.Lucene.Net.Search.LongParser) { InitFieldType(field, LONG); } else if (parser is Mono.Lucene.Net.Search.DoubleParser) { InitFieldType(field, DOUBLE); } else { throw new System.ArgumentException("Parser instance does not subclass existing numeric parser from FieldCache (got " + parser + ")"); } this.reverse = reverse; this.parser = parser; }
private FieldCacheRangeFilter(System.String field, Mono.Lucene.Net.Search.Parser parser, System.Object lowerVal, System.Object upperVal, bool includeLower, bool includeUpper) { this.field = field; this.parser = parser; this.lowerVal = lowerVal; this.upperVal = upperVal; this.includeLower = includeLower; this.includeUpper = includeUpper; }
internal AnonymousClassFieldCacheRangeFilter(System.String Param1, Mono.Lucene.Net.Search.Parser Param2, System.Object Param3, System.Object Param4, bool Param5, bool Param6) : base(Param1, Param2, Param3, Param4, Param5, Param6) { }
internal ByteComparator(int numHits, System.String field, Mono.Lucene.Net.Search.Parser parser) { values = new sbyte[numHits]; this.field = field; this.parser = (ByteParser)parser; }
internal ShortComparator(int numHits, System.String field, Mono.Lucene.Net.Search.Parser parser) { values = new short[numHits]; this.field = field; this.parser = (ShortParser)parser; }
internal LongComparator(int numHits, System.String field, Mono.Lucene.Net.Search.Parser parser) { values = new long[numHits]; this.field = field; this.parser = (LongParser)parser; }
/// <summary>Creates a sort by terms in the given field, parsed /// to numeric values using a custom {@link FieldCache.Parser}. /// </summary> /// <param name="field"> Name of field to sort by. Must not be null. /// </param> /// <param name="parser">Instance of a {@link FieldCache.Parser}, /// which must subclass one of the existing numeric /// parsers from {@link FieldCache}. Sort type is inferred /// by testing which numeric parser the parser subclasses. /// </param> /// <throws> IllegalArgumentException if the parser fails to </throws> /// <summary> subclass an existing numeric parser, or field is null /// </summary> public SortField(System.String field, Mono.Lucene.Net.Search.Parser parser) : this(field, parser, false) { }
private FieldCacheRangeFilter(System.String field, Mono.Lucene.Net.Search.Parser parser, System.Object lowerVal, System.Object upperVal, bool includeLower, bool includeUpper) { this.field = field; this.parser = parser; this.lowerVal = lowerVal; this.upperVal = upperVal; this.includeLower = includeLower; this.includeUpper = includeUpper; }
internal static ScoreDocComparator GetCachedComparator(IndexReader reader, System.String field, int type, Mono.Lucene.Net.Search.Parser parser, System.Globalization.CultureInfo locale, SortComparatorSource factory) { if (type == SortField.DOC) { return(Mono.Lucene.Net.Search.ScoreDocComparator_Fields.INDEXORDER); } if (type == SortField.SCORE) { return(Mono.Lucene.Net.Search.ScoreDocComparator_Fields.RELEVANCE); } FieldCacheImpl.Entry entry = (factory != null)?new FieldCacheImpl.Entry(field, factory):((parser != null)?new FieldCacheImpl.Entry(field, type, parser):new FieldCacheImpl.Entry(field, type, locale)); return((ScoreDocComparator)Comparators.Get(reader, entry)); }
protected internal override System.Object CreateValue(IndexReader reader, FieldCacheImpl.Entry entryKey) { FieldCacheImpl.Entry entry = (FieldCacheImpl.Entry)entryKey; System.String fieldname = entry.field; int type = entry.type; System.Globalization.CultureInfo locale = entry.locale; Mono.Lucene.Net.Search.Parser parser = null; SortComparatorSource factory = null; if (entry.custom is SortComparatorSource) { factory = (SortComparatorSource)entry.custom; } else { parser = (Mono.Lucene.Net.Search.Parser)entry.custom; } ScoreDocComparator comparator; switch (type) { case SortField.AUTO: comparator = Mono.Lucene.Net.Search.FieldSortedHitQueue.ComparatorAuto(reader, fieldname); break; case SortField.INT: comparator = Mono.Lucene.Net.Search.FieldSortedHitQueue.comparatorInt(reader, fieldname, (Mono.Lucene.Net.Search.IntParser)parser); break; case SortField.FLOAT: comparator = Mono.Lucene.Net.Search.FieldSortedHitQueue.comparatorFloat(reader, fieldname, (Mono.Lucene.Net.Search.FloatParser)parser); break; case SortField.LONG: comparator = Mono.Lucene.Net.Search.FieldSortedHitQueue.comparatorLong(reader, fieldname, (Mono.Lucene.Net.Search.LongParser)parser); break; case SortField.DOUBLE: comparator = Mono.Lucene.Net.Search.FieldSortedHitQueue.comparatorDouble(reader, fieldname, (Mono.Lucene.Net.Search.DoubleParser)parser); break; case SortField.SHORT: comparator = Mono.Lucene.Net.Search.FieldSortedHitQueue.comparatorShort(reader, fieldname, (Mono.Lucene.Net.Search.ShortParser)parser); break; case SortField.BYTE: comparator = Mono.Lucene.Net.Search.FieldSortedHitQueue.comparatorByte(reader, fieldname, (Mono.Lucene.Net.Search.ByteParser)parser); break; case SortField.STRING: if (locale != null) { comparator = Mono.Lucene.Net.Search.FieldSortedHitQueue.comparatorStringLocale(reader, fieldname, locale); } else { comparator = Mono.Lucene.Net.Search.FieldSortedHitQueue.comparatorString(reader, fieldname); } break; case SortField.CUSTOM: comparator = factory.NewComparator(reader, fieldname); break; default: throw new System.SystemException("unknown field type: " + type); } return(comparator); }
/// <summary>Creates a sort, possibly in reverse, by terms in the given field, parsed /// to numeric values using a custom {@link FieldCache.Parser}. /// </summary> /// <param name="field"> Name of field to sort by. Must not be null. /// </param> /// <param name="parser">Instance of a {@link FieldCache.Parser}, /// which must subclass one of the existing numeric /// parsers from {@link FieldCache}. Sort type is inferred /// by testing which numeric parser the parser subclasses. /// </param> /// <param name="reverse">True if natural order should be reversed. /// </param> /// <throws> IllegalArgumentException if the parser fails to </throws> /// <summary> subclass an existing numeric parser, or field is null /// </summary> public SortField(System.String field, Mono.Lucene.Net.Search.Parser parser, bool reverse) { if (parser is Mono.Lucene.Net.Search.IntParser) InitFieldType(field, INT); else if (parser is Mono.Lucene.Net.Search.FloatParser) InitFieldType(field, FLOAT); else if (parser is Mono.Lucene.Net.Search.ShortParser) InitFieldType(field, SHORT); else if (parser is Mono.Lucene.Net.Search.ByteParser) InitFieldType(field, BYTE); else if (parser is Mono.Lucene.Net.Search.LongParser) InitFieldType(field, LONG); else if (parser is Mono.Lucene.Net.Search.DoubleParser) InitFieldType(field, DOUBLE); else { throw new System.ArgumentException("Parser instance does not subclass existing numeric parser from FieldCache (got " + parser + ")"); } this.reverse = reverse; this.parser = parser; }