How to search with rank?
I need to search my website data using ranks to deliver the most relevant
results. For instance:
Class Project has Description and Name.
If I have the following data:
Description = "test"; Name = "testing"
Description = "test"; Name = "creating"
Description = "crazy"; Name = "frog"
Then if I search for test testing I should get the first and second row as
a result, but the first row should be the first result since it had more
words matching.
I already perform this search using LinqKit's PredicateBuilder as follows:
if (!string.IsNullOrEmpty(description))
predicate = predicate.Or(p => p.Description.Contains(description));
if (!string.IsNullOrEmpty(name))
predicate = predicate.Or(p => p.Name.Contains(name));
The question is how to rank this search to order the results by the record
with more relevancy?
Thanks!
No comments:
Post a Comment