Commits

Anonymous committed 1112bb7

Adding index

Comments (1)

Files changed (2)

HamOntFire.Core/Domain/EventIndex.cs

             Sort(result => result.Count, SortOptions.Int);
         }
     }
+
+    public class Events_ByTweetIdSortByTweetId : AbstractIndexCreationTask<Event>
+    {
+        public Events_ByTweetIdSortByTweetId()
+        {
+            Map = events => from doc in events
+                            select new {TweetId = doc.TweetId};
+            Sort(x => x.TweetId, SortOptions.Long);
+        }
+    }
 }

HamOntFire.Core/TweetManager.cs

 
         public long GetGreatestTweetId()
         {
-            var @event = _session.Query<Event>().OrderByDescending(e => e.TweetId).FirstOrDefault();
+            var @event = _session.Query<Event>("Events/ByTweetIdSortByTweetId").OrderByDescending(e => e.TweetId).FirstOrDefault();
             long tweetsSince = 0;
             if (@event != null)
                 tweetsSince = @event.TweetId;