Exemple #1
0
        /// <summary>
        /// 高级搜索
        /// </summary>
        /// <param name="types"></param>
        /// <param name="orgs"></param>
        /// <param name="authors"></param>
        /// <param name="securitycodes"></param>
        /// <param name="industrys"></param>
        /// <param name="concepts"></param>
        /// <param name="ratings"></param>
        /// <param name="ratingchanges"></param>
        /// <param name="date"></param>
        /// <param name="title"></param>
        /// <param name="text"></param>
        /// <param name="pageIndex"></param>
        /// <param name="limit"></param>
        /// <returns></returns>
        public static String Search(String types, String orgs, String authors, String authornames, String authorgroup, String securitycodes, String industrys,
                                    String concepts, String ratings, String ratingchanges, String date, String title,
                                    String text, String columnType, String pageIndex, String limit)
        {
            String terms = String.Empty;

            terms = GetTerms(date, title, text, authornames, authorgroup);
            SktSrhModel <ReportSktSrhQryModel> queryModel = new SktSrhModel <ReportSktSrhQryModel>("H3", pageIndex, limit,
                                                                                                   new ReportSktSrhQryModel(GetParams(types), GetParams(orgs),
                                                                                                                            GetParams(authors), GetParams(securitycodes),
                                                                                                                            GetParams(industrys), GetParams(concepts),
                                                                                                                            GetParams(ratings), GetParams(ratingchanges), terms, columnType));
            String result = String.Empty;

            try
            {
                result = (String)DataAccess.QueryIndex(JsonConvert.SerializeObject(queryModel));
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog("Search.do发生异常", ex);
                throw ex;
            }

            return(result);
        }
Exemple #2
0
 /// <summary>
 /// 新通道-简单搜索
 /// </summary>
 public static object GetNoticeByParam(String id, String securityCodes, String terms, String pageIndex, String limit, String order, String sort)
 {
     try
     {
         SktSrhModel <NoticeSktSrhQryModel> queryModel = new SktSrhModel <NoticeSktSrhQryModel>("H2", new NoticeSktSrhQryModel());
         queryModel.comm.pageno   = pageIndex;
         queryModel.comm.pagesize = limit;
         if (!String.IsNullOrEmpty(id))
         {
             queryModel.query.types = new String[1] {
                 id
             }
         }
         ;
         if (!String.IsNullOrEmpty(securityCodes))
         {
             queryModel.query.securitycodes = securityCodes.Split(',');
         }
         queryModel.query.terms = terms;
         object objRs = DataAccess.QueryIndex(JsonConvert.SerializeObject(queryModel));
         return(objRs);
     }
     catch (Exception ex)
     {
         LogHelper.WriteLog("公告简单搜索出错:", ex);
         return(null);
     }
 }
Exemple #3
0
        /// <summary>
        /// 新通道-简单搜索
        /// </summary>
        public static object GetNewsByParam(String id, String securityCodes, String term, String pageIndex, String limit, String order, String sort)
        {
            String errorquery = String.Empty;

            try
            {
                SktSrhModel <NewsSktSrhQryModel> queryModel = new SktSrhModel <NewsSktSrhQryModel>("H1", new NewsSktSrhQryModel());
                queryModel.comm.pageno   = pageIndex;
                queryModel.comm.pagesize = limit;
                if (!String.IsNullOrEmpty(id))
                {
                    queryModel.query.types = new String[1] {
                        id
                    }
                }
                ;
                if (!String.IsNullOrEmpty(securityCodes))
                {
                    queryModel.query.securitycodes = securityCodes.Split(',');
                }
                queryModel.query.terms = HttpUtility.UrlDecode(term);//LQ 以前是"("+term+")"
                errorquery             = JsonConvert.SerializeObject(queryModel);
                object objRs = DataAccess.QueryIndex(JsonConvert.SerializeObject(queryModel));
                return(objRs);
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog("请求条件为:" + errorquery + "新闻简单搜索出错:", ex);
                return(null);
            }
        }
Exemple #4
0
        /// <summary>
        /// 新通道的高级搜索
        /// </summary>
        /// <param name="types">栏目id集合</param>
        /// <param name="securitycodes">证券代码集合</param>
        /// <param name="date">日期</param>
        /// <param name="title">标题</param>
        /// <param name="text">正文</param>
        /// <param name="columnType">栏目类型</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="limit">记录数</param>
        /// <returns></returns>
        public object GetNoticeBySearch(String types, String securitycodes,
                                        String date, String title,
                                        String text, String columnType, String pageIndex, String limit)
        {
            String terms = String.Empty;

            if (!String.IsNullOrEmpty(date))
            {
                //add by lym
                try
                {
                    date = date.Replace("99:99:99", "23:59:59");
                    String startdate = String.Empty;
                    String enddate   = String.Empty;
                    startdate = Convert.ToDateTime(date.Substring(0, date.IndexOf(" TO ")).Split(new char[] { 'T' })[0]).ToString("yyyy-MM-dd") + "T00:00:00Z";
                    enddate   = Convert.ToDateTime(date.Substring(date.IndexOf(" TO ") + 4).Split(new char[] { 'T' })[0]).ToString("yyyy-MM-dd") + "T23:59:59Z";
                    date      = startdate + " TO " + enddate;
                }
                catch (Exception ex)
                {
                }

                terms += "datetime:[" + date + "]";
            }
            if (!String.IsNullOrEmpty(title))
            {
                if (!String.IsNullOrEmpty(terms))
                {
                    terms += "AND (title:" + CommDao.SafeToIndexString(HttpUtility.UrlDecode(title)) + ")";
                }
                else
                {
                    terms += "(title:" + CommDao.SafeToIndexString(HttpUtility.UrlDecode(title)) + ")";
                }
            }
            if (!String.IsNullOrEmpty(text))
            {
                if (!String.IsNullOrEmpty(terms))
                {
                    terms += "AND (text:" + CommDao.SafeToIndexString(HttpUtility.UrlDecode(text)) + " OR title:" + CommDao.SafeToIndexString(HttpUtility.UrlDecode(text)) + ")";
                }
                else
                {
                    terms += "(text:" + CommDao.SafeToIndexString(HttpUtility.UrlDecode(text)) + " OR title:" + CommDao.SafeToIndexString(HttpUtility.UrlDecode(text)) + ")";
                }
            }
            SktSrhModel <NoticeSktSrhQryModel> queryModel = new SktSrhModel <NoticeSktSrhQryModel>("H2", pageIndex, limit,
                                                                                                   new NoticeSktSrhQryModel(GetParams(types), GetParams(securitycodes), terms, columnType));
            String result = String.Empty;

            try
            {
                result = (String)DataAccess.QueryIndex(JsonConvert.SerializeObject(queryModel));
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog("GetNoticeBySearch.do发生异常", ex);
                throw ex;
            }
            return(result);
        }