예제 #1
0
        protected override CustomScoreProvider GetCustomScoreProvider(IndexReader reader)
        {
            int maxDoc = reader.MaxDoc;
            long[] daysAgo = new long[maxDoc];
            long[] publishDate = FieldCache_Fields.DEFAULT.GetLongs(reader, SearchDocument.TimeStampFieldName);
            long currentDate = DateTime.UtcNow.ToFileTime();
            long timeSpanFromDaysTicks = TimeSpan.FromDays(36500).Ticks;

            for (int i = 0; i < maxDoc; i++)
            {
                if (!reader.IsDeleted(i))
                    daysAgo[i] = currentDate - publishDate[i];
            }
            var recencyData = new RecencyOptions(daysAgo, 5, timeSpanFromDaysTicks);

            return new RecencyScoreProvider(reader, recencyData);
        }
예제 #2
0
 public RecencyScoreProvider(IndexReader reader, RecencyOptions recencyData)
     : base(reader)
 {
     _recencyData = recencyData;
 }