Answer the question
In order to leave comments, you need to log in
How to display matched search results?
Good day to all.
Previously, I implemented the search through a similarity query: SELECT * FROM table WHERE title LIKE "%слово%"
Everything is fine, but now it became necessary to sort the results by their similarity, i.e. the first results are those that are more similar or where the given string matches more (by number).
For example, I'm looking for the word "hare".
Entries should be displayed in this order:
id | title
------------------------------------------------- ------------------------------------
1| A hare and another hare, and another hare after that hare
2| One hare, and one more hare, after that hare
3| Hare and hare
4| Hare yats
5| Hare
The question itself - is it possible to somehow implement such sorting through sql query or other methods?
Thank you for your attention!
Answer the question
In order to leave comments, you need to log in
in MS SQL, you need to use Data Quality Service - as a result of the query, there will be a Similarity column (similarity - in percent), you can sort
it and something similar should be in other DBMS
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question