Maybe you can do it this way?
main console program i used to test
static void Main(string[] args)
{
var list = SearchResult.GetResult();
var wordArray = "Geo,JCB".Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
list.Sort((a, b) => {
int sum1 = 0, sum2=0;
foreach (var item in wordArray)
{
sum1 += Regex.Matches(a.Description, item).Count;
sum2 += Regex.Matches(b.Description, item).Count;
}
if (sum1 < sum2) return 1;
else if (sum1 > sum2) return -1;
else return 0;
});
foreach (var item in list)
{
Console.WriteLine(item.Description);
}
Console.ReadKey();
}
the searchresult class
public class SearchResult
{
public string Description { get; set; }
public static List<SearchResult> GetResult()
{
var list = new List<SearchResult>()
{
new SearchResult(){Description = "JCB Excavator - ECU P/N: 728/35700"},
new SearchResult(){Description = "Geo Prism 1995 Geo cart Geo001 -Geo ABS #16213899"},
new SearchResult(){Description = "Geo Prism 1995 - Geo ABS #16213899"},
new SearchResult(){Description = "Geo Prism 1995 - ABS #16213899"},
new SearchResult(){Description = "Wie man BBA reman erreicht"},
new SearchResult(){Description = "this JCB test JCB"},
new SearchResult(){Description = "Ersatz Airbags, Gurtstrammer und Auto Körper Teile"}
};
return list;
}
}
returning properoutput for what u asked...
which is
Geo Prism 1995 Geo cart Geo001 -Geo ABS #16213899
Geo Prism 1995 - Geo ABS #16213899
this JCB test JCB
Geo Prism 1995 - ABS #16213899
JCB Excavator - ECU P/N: 728/35700
Ersatz Airbags, Gurtstrammer und Auto Körper Teile
Wie man BBA reman erreicht