/// <summary> Creates one of these objects for a custom comparator.  </summary>
 public SortFieldEntry(string field, FieldComparatorSource custom)
 {
     Field = string.Intern(field);
     Type = SortField.CUSTOM;
     Custom = custom;
     Locale = null;
 }
        internal readonly CultureInfo Locale; // the locale we're sorting (if string)

        /// <summary> Creates one of these objects.  </summary>
        public SortFieldEntry(string field, int type, CultureInfo locale)
        {
            Field = string.Intern(field);
            Type = type;
            Custom = null;
            Locale = locale;
        }
Beispiel #3
0
        /// <summary>
        /// Lucene.Net specific. Needed for deserialization
        /// </summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected SortField(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
        {
            //Should we add other fields as in NumericRangeQuery? {{DIGY}}

            type             = (int)info.GetValue("type", typeof(int));
            useLegacy        = (bool)info.GetValue("useLegacy", typeof(bool));
            reverse          = (bool)info.GetValue("reverse", typeof(bool));
            locale           = (System.Globalization.CultureInfo)info.GetValue("locale", typeof(System.Globalization.CultureInfo));
            comparatorSource = (FieldComparatorSource)info.GetValue("comparatorSource", typeof(FieldComparatorSource));
            factory          = (SortComparatorSource)info.GetValue("factory", typeof(FieldComparatorSource));
            parser           = (Parser)info.GetValue("parser", typeof(Parser));

            field = StringHelper.Intern((string)info.GetValue("field", typeof(string)));
        }
Beispiel #4
0
        /// <summary>
        /// Lucene.Net specific. Needed for deserialization
        /// </summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected SortField(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
        {
            //Should we add other fields as in NumericRangeQuery? {{DIGY}}

            type        = (int)info.GetValue("type", typeof(int));
            useLegacy   = (bool)info.GetValue("useLegacy", typeof(bool));
            reverse     = (bool)info.GetValue("reverse", typeof(bool));
            locale      = (System.Globalization.CultureInfo)info.GetValue("locale", typeof(System.Globalization.CultureInfo));
            comparatorSource = (FieldComparatorSource)info.GetValue("comparatorSource", typeof(FieldComparatorSource));
            factory          = (SortComparatorSource)info.GetValue("factory", typeof(FieldComparatorSource));
            parser           = (Parser)info.GetValue("parser", typeof(Parser));
                        
            field       = StringHelper.Intern((string)info.GetValue("field", typeof(string)));
        }
Beispiel #5
0
		/// <summary>Creates a sort, possibly in reverse, with a custom comparison function.</summary>
		/// <param name="field">Name of field to sort by; cannot be <code>null</code>.
		/// </param>
		/// <param name="comparator">Returns a comparator for sorting hits.
		/// </param>
		/// <param name="reverse">True if natural order should be reversed.
		/// </param>
		public SortField(System.String field, FieldComparatorSource comparator, bool reverse)
		{
			InitFieldType(field, CUSTOM);
			this.reverse = reverse;
			this.comparatorSource = comparator;
		}
Beispiel #6
0
		/// <summary>Creates a sort with a custom comparison function.</summary>
		/// <param name="field">Name of field to sort by; cannot be <code>null</code>.
		/// </param>
		/// <param name="comparator">Returns a comparator for sorting hits.
		/// </param>
		public SortField(System.String field, FieldComparatorSource comparator)
		{
			InitFieldType(field, CUSTOM);
			this.comparatorSource = comparator;
		}
 /// <summary>Creates a sort, possibly in reverse, with a custom comparison function.</summary>
 /// <param name="field">Name of field to sort by; cannot be <c>null</c>.
 /// </param>
 /// <param name="comparator">Returns a comparator for sorting hits.
 /// </param>
 /// <param name="reverse">True if natural order should be reversed.
 /// </param>
 public SortField(System.String field, FieldComparatorSource comparator, bool reverse)
 {
     InitFieldType(field, CUSTOM);
     this.reverse          = reverse;
     this.comparatorSource = comparator;
 }
 /// <summary>Creates a sort with a custom comparison function.</summary>
 /// <param name="field">Name of field to sort by; cannot be <c>null</c>.
 /// </param>
 /// <param name="comparator">Returns a comparator for sorting hits.
 /// </param>
 public SortField(System.String field, FieldComparatorSource comparator)
 {
     InitFieldType(field, CUSTOM);
     this.comparatorSource = comparator;
 }
Beispiel #9
0
 /// <summary>
 /// Creates a sort with a custom comparison function. </summary>
 /// <param name="field"> Name of field to sort by; cannot be <code>null</code>. </param>
 /// <param name="comparator"> Returns a comparator for sorting hits. </param>
 public SortField(string field, FieldComparatorSource comparator)
 {
     InitFieldType(field, Type_e.CUSTOM);
     this.comparatorSource = comparator;
 }
Beispiel #10
0
 /// <summary>
 /// Creates a sort with a custom comparison function. </summary>
 /// <param name="field"> Name of field to sort by; cannot be <code>null</code>. </param>
 /// <param name="comparator"> Returns a comparator for sorting hits. </param>
 public SortField(string field, FieldComparatorSource comparator)
 {
     InitFieldType(field, Type_e.CUSTOM);
     this.comparatorSource = comparator;
 }