I am trying to write code for getting records from EF which are similar to already existing records. (Exactly the same that SO is doing with Questions that may already have your answer
). I have a title and I want to found similar records in database.
I found this SO question. I am sure the PredicateBuilder is the way to do this kind of things.
But, I didn't found a way how can I sort results by how many words are in both titles. (First records that matches more words and so on.)
For example:
My database has records:
1 Test my code
2 Another test
3 This is similar test
4 Test code for another partner with bugs
5 Test bugs
and user enters Test my code for bugs
.
Result would be sorted like this:
4 Test code for another partner with bugs //(3 matches: test, code and bugs)
5 Test bugs //(2 matches: test and bugs)
1 Test my code //(2 matches: test and code
2 Another test //(1 match: test)
3 This is similar test //(1 match: test)
I am using ASP.NET Core 1.1