public EpgEventInfoR() { ShortInfo = new EpgShortEventInfo(); ExtInfo = new EpgExtendedEventInfo(); ContentInfo = new EpgContentInfo(); _componentInfoAnalyzer = new ComponentInfoAnalyzer(this); }
public List <RecLogItem> search_Like(SqlCommand cmd0, string searchWord0, RecLogItem.RecodeStatuses recodeStatuse0, searchColumns searchColumn0 = searchColumns.title, int count0 = 50, EpgContentInfo epgContentInfo0 = null) { List <string> searchWordList1 = getSearchWordList(searchWord0); StringBuilder sb1 = new StringBuilder(); foreach (var item1 in searchWordList1) { string likeWord1 = " LIKE " + createTextValue("%" + item1 + "%"); List <string> searchWords1 = new List <string>(); if (searchColumn0.HasFlag(searchColumns.title)) { searchWords1.Add(DB_EpgEventInfo.TABLE_NAME_ABBR + "." + DB_EpgEventInfo.COLUMN_ShortInfo_event_name + likeWord1); } if (searchColumn0.HasFlag(searchColumns.content)) { searchWords1.Add(DB_EpgEventInfo.TABLE_NAME_ABBR + "." + DB_EpgEventInfo.COLUMN_ShortInfo_text_char + likeWord1); searchWords1.Add(DB_EpgEventInfo.TABLE_NAME_ABBR + "." + DB_EpgEventInfo.COLUMN_ExtInfo_text_char + likeWord1); } if (searchColumn0.HasFlag(searchColumns.comment)) { searchWords1.Add(TABLE_NAME_ABBR + "." + COLUMN_comment + likeWord1); } if (searchColumn0.HasFlag(searchColumns.recFilePath)) { searchWords1.Add(TABLE_NAME_ABBR + "." + COLUMN_RecFilePath + likeWord1); } StringBuilder sb2 = new StringBuilder(); foreach (var item2 in searchWords1) { if (0 < sb2.Length) { sb2.Append(" OR "); } sb2.Append(item2); } // if (0 < sb1.Length) { sb1.Append(" AND "); } sb1.Append(sb2.ToString()); } return(seach(sb1.ToString(), recodeStatuse0, count0, cmd0, epgContentInfo0)); }
public List <RecLogItem> search_Like(string searchWord0, RecLogItem.RecodeStatuses recodeStatuse0, searchColumns searchColumn0 = searchColumns.title, int count0 = 50, EpgContentInfo epgContentInfo0 = null) { try { using (SqlConnection sqlConn1 = new SqlConnection(sqlConnStr)) { sqlConn1.Open(); using (SqlCommand cmd1 = sqlConn1.CreateCommand()) { return(search_Like(cmd1, searchWord0, recodeStatuse0, searchColumn0, count0, epgContentInfo0)); } } } catch (Exception ex0) { System.Diagnostics.Trace.WriteLine(ex0); } return(new List <RecLogItem>()); }
List <RecLogItem> seach(string searchWordQuery0, RecLogItem.RecodeStatuses recodeStatuse0, int count0, SqlCommand cmd0, EpgContentInfo epgContentInfo0) { List <RecLogItem> itemList1 = new List <RecLogItem>(); if (recodeStatuse0 == RecLogItem.RecodeStatuses.NONE) { return(itemList1); } // StringBuilder query1 = new StringBuilder(); query1.Append("SELECT"); if (0 < count0) { query1.Append(" TOP " + count0); } query1.Append(" * FROM " + tableName + " " + TABLE_NAME_ABBR + " INNER JOIN " + DB_EpgEventInfo.TABLE_NAME + " " + DB_EpgEventInfo.TABLE_NAME_ABBR + " ON (" + TABLE_NAME_ABBR + "." + COLUMN_epgEventInfoID + "=" + DB_EpgEventInfo.TABLE_NAME_ABBR + "." + DB_EpgEventInfo.COLUMN_ID + ")"); StringBuilder where1 = new StringBuilder(); where1.Append(getRecodeStatusQuery(recodeStatuse0)); if (!string.IsNullOrEmpty(searchWordQuery0)) { if (0 < where1.Length) { where1.Append(" AND "); } where1.Append("(" + searchWordQuery0 + ")"); } if (0 < where1.Length) { query1.Append(" WHERE " + where1.ToString()); } query1.Append(" ORDER BY " + DB_EpgEventInfo.TABLE_NAME_ABBR + "." + DB_EpgEventInfo.COLUMN_start_time + " DESC"); cmd0.CommandText = query1.ToString(); using (SqlDataReader reader1 = cmd0.ExecuteReader()) { while (reader1.Read()) { int i1 = 0; RecLogItem recLogItem1 = getItem(reader1, ref i1); recLogItem1.epgEventInfoR = db_EpgEventInfo.getItem(reader1, ref i1); if (epgContentInfo0 != null) { bool isMatch1 = false; foreach (EpgContentData ecd1 in epgContentInfo0.nibbleList) { if (recLogItem1.epgEventInfoR.ContentInfo.nibbleList.Count == 0) // ジャンル情報が無い { isMatch1 = true; } else { isMatch1 = recLogItem1.epgEventInfoR.ContentInfo.nibbleList.Exists( x1 => { return(x1.content_nibble_level_1 == ecd1.content_nibble_level_1); }); } if (isMatch1) { break; } } if (!isMatch1) { recLogItem1 = null; } } if (recLogItem1 != null) { itemList1.Add(recLogItem1); } } } //if (itemList1.Count == 0) { // Console.WriteLine(query1); //} return(itemList1); }
public List <RecLogItem> search_Fulltext(SqlCommand cmd0, string searchWord0, RecLogItem.RecodeStatuses recodeStatuse0, searchColumns searchColumn0 = searchColumns.title, int count0 = 50, EpgContentInfo epgContentInfo0 = null, bool isFreetext0 = false) { List <string> searchWordList1; if (isFreetext0) { searchWordList1 = new List <string>() { searchWord0 }; } else { searchWordList1 = getSearchWordList(searchWord0); } string searchWordQuery_Fulltext1 = getSearchWordQuery_Fulltext(searchColumn0, searchWordList1, isFreetext0); return(seach(searchWordQuery_Fulltext1, recodeStatuse0, count0, cmd0, epgContentInfo0)); }
/// <summary> /// フルテキストのFREETEXTで得た結果をRegexで絞り込む /// </summary> /// <param name="searchWord0"></param> /// <param name="recodeStatuse0"></param> /// <param name="searchColumn0"></param> /// <param name="count0"></param> /// <returns></returns> public List <RecLogItem> search_Fulltext_Freetext_Regex(string searchWord0, RecLogItem.RecodeStatuses recodeStatuse0, searchColumns searchColumn0 = searchColumns.title, int count0 = 50, EpgContentInfo epgContentInfo0 = null) { List <RecLogItem> recLogItemList1 = new List <RecLogItem>(); List <string> searchWordList1 = new List <string>() { searchWord0 }; string searchWordQuery_Fulltext1 = getSearchWordQuery_Fulltext(searchColumn0, searchWordList1, true); List <RecLogItem> recLogItemList2 = new List <RecLogItem>(); try { using (SqlConnection sqlConn1 = new SqlConnection(sqlConnStr)) { sqlConn1.Open(); using (SqlCommand cmd1 = sqlConn1.CreateCommand()) { recLogItemList2 = seach(searchWordQuery_Fulltext1, recodeStatuse0, count0, cmd1, epgContentInfo0); } } } catch (Exception ex0) { System.Diagnostics.Trace.WriteLine(ex0); } List <string> searchWordList2 = getSearchWordList(searchWord0); List <Regex> searchRegexList2 = new List <Regex>(); foreach (var item in searchWordList2) { searchRegexList2.Add(new Regex(item)); } foreach (var recLogItem1 in recLogItemList2) { List <string> textList1 = new List <string>(); if (searchColumn0.HasFlag(searchColumns.title)) { textList1.Add(recLogItem1.tvProgramTitle); } if (searchColumn0.HasFlag(searchColumns.content)) { textList1.Add(recLogItem1.tvProgramSummary); } if (searchColumn0.HasFlag(searchColumns.comment)) { textList1.Add(recLogItem1.comment); } if (searchColumn0.HasFlag(searchColumns.recFilePath)) { textList1.Add(recLogItem1.recFilePath); } foreach (var text1 in textList1) { int matchCnt1 = 0; foreach (var rgx1 in searchRegexList2) { if (rgx1.IsMatch(text1)) { matchCnt1++; } } if (matchCnt1 == searchRegexList2.Count) { recLogItemList1.Add(recLogItem1); break; } } } return(recLogItemList1); }