//[WebMethod(Description = "GenQuery")]
        public string GenQuery(string keyword, string AdminLevel3, string AdminLevel2, string AdminLevel1, string PostCode, string AdminLevel4, string category, string tag, string lat, string lon, string radius, string RowsPerPage, string PageNumber, string token)
        {
            List <string> array  = category.Split('|').ToList(); // Split by comma
            List <string> array2 = tag.Split('|').ToList();

            try
            {
                _c_function fn = new _c_function();

                // Declare Latlon and URI
                string latlon     = lat + "," + lon;
                string URI        = "";
                string Nearby     = ""; // For Search Nearby
                string cutsubnear = "";
                string cutsubre   = "";
                // result
                DataTable temp = new DataTable();



                //Get Synonym
                int synocheck = 0;
                temp = fn.synonymSearch(keyword, latlon, RowsPerPage, PageNumber, ref synocheck, array);

                //Fix &
                keyword = keyword.Trim().Replace("&", "%26");

                //Create Query String
                fn.createSolrQueryString(ref URI, keyword, latlon, radius, array, array2, AdminLevel4, "6", AdminLevel3, AdminLevel2, AdminLevel1, PostCode);

                //Fix Bug Page Number
                if (PageNumber == "1")
                {
                    PageNumber = "0";
                }
                else
                {
                    PageNumber = int.Parse(PageNumber) - 1 + "";
                }

                //Finally We Got QUERY STRING
                URI = URI + "&start=" + int.Parse(RowsPerPage) * (int.Parse(PageNumber)) + "&rows=" + RowsPerPage;

                return(URI);
            }
            catch (Exception e)
            {
                return("");
            }
        }
        public string Search_Nearby(string lat, string lon, string distance, string numreturn, string token)
        {
            try
            {
                if (token == "43f9952b429485e270ccf674f")
                {
                    double dist = (double.Parse(distance) / 1000);

                    _c_function fn = new _c_function();

                    string        latlon = lat + "," + lon;
                    string        URI    = "";
                    List <string> li     = new List <string>();
                    fn.createSolrQueryString(ref URI, "*", latlon, dist.ToString(), li, li, "", "5", "", "", "", "");
                    URI = URI + "&start=0&rows=" + numreturn;

                    DataTable result = fn.CallSolr_DT(URI);


                    StringBuilder sb = new StringBuilder();

                    try
                    {
                        if (result.Rows.Count == 0)
                        {
                            return("NotFound");
                        }
                    }
                    catch (Exception e) { }

                    for (int i = 0; i < result.Rows.Count; i++)
                    {
                        sb.Append(result.Rows[i]["Name_Local"] + "!" + result.Rows[i]["Name_English"] + "!" + (1000 * double.Parse(result.Rows[i]["dist"].ToString())).ToString("F2"));
                        sb.Append("|");
                    }

                    return(sb.ToString());
                }
                else
                {
                    return("you don't have permission");
                }
            }
            catch (Exception) {
                return("Error in code Please contact developer.");
            }
        }