This is a continuation of this thread about Storing an Index in SQL Server.
I have decided that I am going to use the code that r937 has provided to give me a SQL table containing the following.
ID URL CONTENT
------------------------------------------------------------
1 a.com it is what it is
2 b.com what is it
3 c.com it is a banana
As I’ve said in the previous thread I want to run a search for the term “what is it”. In doing so, I would like the rows to be sorted by relevancy, meaning that every row would be included, but row 2 would be at the top because it contains the whole term “what is it”, whereas the other two contain just the words/some of the words.
In order to do this I am going to store these contents in a new class, like so:
public class MyObject {
public int id { get; set; }
public string url { get; set; }
public string content { get; set; }
}
What I would like to do is create a List of type MyObject (List<MyObject>) and then sort it in the way I require (by relevancy to a string).
How would I go about doing this in C#?