Exemple #1
0
        public void Handle(NameChangedEvent notification)
        {
            var search = new UserSearchEngine();

            search.Update(new UserSearchItem {
                UserId = notification.UserId, FirstName = notification.FirstName, LastName = notification.LastName
            });
        }
Exemple #2
0
        protected void BuildIndex()
        {
            var userSearch = new UserSearchEngine();

            using (var connection = GetConnection())
            {
                userSearch.BuildIndex(connection.Query <UserSearchItem>("select u.id userId, firstName, lastName from persons p inner join users u on u.personid = p.id").ToList());
            }
        }
        public void SimpleSearch2()
        {
            string searchQuery = "invi";

            IUserSearchEngine searchEngine = new UserSearchEngine(TokenTestSingleton.Instance);
            List <IUser>      searchResult = searchEngine.Search(searchQuery, 2, 2);

            Assert.AreNotEqual(searchResult, null);
            Assert.AreEqual(searchResult.Count, 2);
        }
        public void SimpleSearch3()
        {
            string searchQuery = "TweetinviApi";

            UserSearchEngine searchEngine = new UserSearchEngine(TokenTestSingleton.Instance);
            List <IUser>     searchResult = searchEngine.Search(searchQuery, 2, 0);

            Assert.AreNotEqual(searchResult, null);
            Assert.AreEqual(searchResult.Count, 1);
            Assert.AreEqual(searchResult[0].Id, 1577389800);
            Assert.AreEqual(searchResult[0].ScreenName, "TweetinviApi");
        }
        private static void SearchUser(IToken token)
        {
            string searchQuery = "tweetinvi";

            IUserSearchEngine searchEngine = new UserSearchEngine(token);
            List <IUser>      searchResult = searchEngine.Search(searchQuery);

            foreach (var user in searchResult)
            {
                Console.Write(user.ScreenName);
            }
        }
Exemple #6
0
        public ActionResult Search(string searchTerm)
        {
            var searcher = new UserSearchEngine();

            if (searchTerm == "")
            {
                return(Json(searcher.Query(new List <QueryTerm> {
                    new QueryTerm {
                        Field = UserSearchFields.FirstName, Term = searchTerm
                    }
                }), JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(searcher.Query(new List <QueryTerm> {
                    new QueryTerm {
                        Field = UserSearchFields.FirstName, Term = searchTerm
                    },
                    new QueryTerm {
                        Field = UserSearchFields.LastName, Term = searchTerm
                    }
                }), JsonRequestBehavior.AllowGet));
            }
        }