示例#1
0
        /// <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;
        }
示例#2
0
 public void TestInitialize()
 {
     client = YoupElasticSearch.InitializeConnection();
     controllerEvent = new eventsController();
     controllerProfile = new profilesController();
     controllerPlace = new placesController();
     controllerForum = new forumController();
     controllerBlog = new blogController();
 }
示例#3
0
 /// <summary>
 /// supprime un profile
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public bool get_profile(string id = "")
 {
     if (id == "" || id == null) return false;
     profilesController controller = new profilesController();
     controller.RemoveProfile(id);
     return true;
 }
示例#4
0
 /// <summary>
 /// Met à jour un profile
 /// </summary>
 /// <param name="id"></param>
 /// <param name="firstname"></param>
 /// <param name="lastname"></param>
 /// <param name="pseudo"></param>
 /// <param name="activity"></param>
 /// <param name="age"></param>
 /// <param name="sex"></param>
 /// <param name="town"></param>
 /// <returns></returns>
 public bool get_profile(string id = "", string firstname = "", string lastname = "", string pseudo = "", string activity = "",
     int age = 0, bool sex = true, string town = "")
 {
     Profile XNewProfile = new Profile(id, firstname, lastname, pseudo, activity, age, sex, town);
     profilesController controller = new profilesController();
     controller.UpdateProfile(XNewProfile);
     return true;
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="from"></param>
        /// <param name="take"></param>
        /// <param name="keyword"></param>
        /// <param name="age"></param>
        /// <param name="town"></param>
        /// <returns></returns>
        public GenericResponse get_profile(int from=0, int take=20, string keyword="", int? age=null, string town="")
        {
            if (keyword.Contains("%20"))
            {
                keyword.Replace("%20", " ");
            }
            keyword = keyword.ToLower();
            town = town.ToLower();
            GenericResponse myReturn = new GenericResponse();

            //Search in Profiles
            profilesController Pcontroller = new profilesController();
            myReturn.Gprofile = Pcontroller.AdvancedSearchProfile(from, take, keyword, age, town).Hits;
             
            return myReturn;
        }