/// <summary>
        /// Fait une recherche générale dans tout les index grâce au param keyword
        /// </summary>
        /// <param name="keyword"></param>
        /// <param name="from"></param>
        /// <param name="take"></param>
        /// <returns></returns>
        public GenericResponse get(string keyword, int from = 0, int take=20)
        {
          //  var nvc = HttpUtility.ParseQueryString(Request.RequestUri.Query);
            if(keyword.Contains("%20")){
                keyword.Replace("%20", " ");
            }
            keyword = keyword.ToLower();
            GenericResponse myReturn = new GenericResponse();
            
            //Search in Profiles
            profilesController Pcontroller = new profilesController();
            myReturn.Gprofile = Pcontroller.SimpleSearchProfile(keyword, from, take).Hits;            

            //Search in Blogs
            blogController Bcontroller = new blogController();
            myReturn.Gblog = Bcontroller.SimpleSearchBlog(keyword, from, take).Hits;
            myReturn.Gblogpost = Bcontroller.SimpleSearchBlogPost(keyword, from, take).Hits;
            myReturn.Gblogpostcomment = Bcontroller.SimpleSearchBlogComment(keyword, from, take).Hits;
            
            //Search in Events
            eventsController Econtroller = new eventsController();
            myReturn.Gevent = Econtroller.SimpleSearchEvent(keyword, from, take).Hits;

            //Search in Places
            placesController PLcontroller = new placesController();
            myReturn.Gplace = PLcontroller.SimpleSearchPlace(keyword, from, take).Hits;

            //Search in Forum
            forumController Fcontroller = new forumController();
            myReturn.Gpostforum = Fcontroller.SimpleSearchPostForum(keyword, from, take).Hits;

            return myReturn;
        }
Beispiel #2
0
 public void TestInitialize()
 {
     client = YoupElasticSearch.InitializeConnection();
     controllerEvent = new eventsController();
     controllerProfile = new profilesController();
     controllerPlace = new placesController();
     controllerForum = new forumController();
     controllerBlog = new blogController();
 }
 /// <summary>
 /// supprime un post forum
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public bool get_postforum(string id = "")
 {
     if (id == "" || id == null) return false;
     forumController controller = new forumController();
     controller.RemovePostForum(id);
     return true;
 }
 /// <summary>
 /// Met à jour un post forum
 /// </summary>
 /// <param name="id"></param>
 /// <param name="board"></param>
 /// <param name="content"></param>
 /// <param name="date"></param>
 /// <param name="author"></param>
 /// <returns></returns>
 public bool get_postforum(string id = "", string board = "", string content = "", DateTime date = new DateTime(), string author = "")
 {
     PostForum XNewPostForum = new PostForum(id, board, content, date, author);
     forumController controller = new forumController();
     controller.UpdatePostForum(XNewPostForum);
     return true;
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="from"></param>
        /// <param name="take"></param>
        /// <param name="keyword"></param>
        /// <param name="author"></param>
        /// <param name="board"></param>
        /// <param name="date"></param>
        /// <returns></returns>
        public GenericResponse get_postforum(int from=0, int take=20, string keyword="", string author="", string board="", DateTime? date=null)
        {
            if (keyword.Contains("%20"))
            {
                keyword.Replace("%20", " ");
            }
            keyword = keyword.ToLower();

            GenericResponse myReturn = new GenericResponse();
            //Search in Profiles
            forumController Pcontroller = new forumController();
            myReturn.Gpostforum = Pcontroller.AdvancedSearchForum(from, take, keyword, author, board, date).Hits;

            return myReturn;
        }