@@ -1227,37 +1227,38 @@ protected void updateStreamInfo(Broadcast broadcast, BroadcastUpdate newBroadcas
12271227 * They are used by InMemoryDataStore and MapDBStore, Mongodb implements the same functionality inside its own class.
12281228 */
12291229 protected ArrayList <VoD > searchOnServerVod (ArrayList <VoD > broadcastList , String search ){
1230-
1230+
12311231 long startTime = System .nanoTime ();
12321232 if (search != null && !search .isEmpty ()) {
1233+ String searchLower = search .toLowerCase ();
12331234 for (Iterator <VoD > i = broadcastList .iterator (); i .hasNext (); ) {
12341235 VoD item = i .next ();
1235- if (item .getVodName () != null && item .getStreamName () != null && item .getStreamId () != null && item .getVodId () != null ) {
1236- if (item .getVodName ().toLowerCase ().contains (search .toLowerCase ()) || item .getStreamId ().toLowerCase ().contains (search .toLowerCase ()) || item .getStreamName ().toLowerCase ().contains (search .toLowerCase ()) || item .getVodId ().toLowerCase ().contains (search .toLowerCase ()))
1237- continue ;
1238- else i .remove ();
1239- }
1240- else if (item .getVodName ()!= null && item .getVodId () != null ){
1241- if (item .getVodName ().toLowerCase ().contains (search .toLowerCase ()) || item .getVodId ().toLowerCase ().contains (search .toLowerCase ()))
1242- continue ;
1243- else i .remove ();
1244- }
1245- else {
1246- if (item .getVodId () != null ){
1247- if (item .getVodId ().toLowerCase ().contains (search .toLowerCase ()))
1248- continue ;
1249- else i .remove ();
1250- }
1236+ if (matchesVodSearch (item , searchLower )) {
1237+ continue ;
12511238 }
1239+ i .remove ();
12521240 }
12531241 }
1254-
1242+
12551243 long elapsedNanos = System .nanoTime () - startTime ;
12561244 addQueryTime (elapsedNanos );
12571245 showWarningIfElapsedTimeIsMoreThanThreshold (elapsedNanos , "searchOnServerVod" );
12581246 return broadcastList ;
12591247 }
12601248
1249+ private boolean matchesVodSearch (VoD item , String searchLower ) {
1250+ return containsIgnoreCase (item .getVodId (), searchLower ) ||
1251+ containsIgnoreCase (item .getVodName (), searchLower ) ||
1252+ containsIgnoreCase (item .getStreamId (), searchLower ) ||
1253+ containsIgnoreCase (item .getStreamName (), searchLower ) ||
1254+ containsIgnoreCase (item .getDescription (), searchLower ) ||
1255+ containsIgnoreCase (item .getMetadata (), searchLower );
1256+ }
1257+
1258+ private boolean containsIgnoreCase (String field , String searchLower ) {
1259+ return field != null && field .toLowerCase ().contains (searchLower );
1260+ }
1261+
12611262 protected List <VoD > sortAndCropVodList (List <VoD > vodList , int offset , int size , String sortBy , String orderBy )
12621263 {
12631264 long startTime = System .nanoTime ();
0 commit comments