/// <summary> /// Search the table using the search object passed in parameter. The search will /// be executed using the specified index or the index that best matches the criterias. /// </summary> /// <param name="search">Search containing the list of criterias to apply</param> /// <param name="index">Optionally force an index</param> /// <returns></returns> public TRow[] Search(TSearch search, TableIndex <TRow, TSearch> index = null) { var criterias = _mappings.ExtractCriterias(search); if (index != null) { return(index.Search(criterias)); } var bestIndex = _indexes.GetBestIndex(criterias); // Null is returned when any of the index find that this search will return // an empty result set. if (bestIndex == null) { return(ArrayUtilities <TRow> .EmptyArray); } return(bestIndex.Search(criterias)); }