'How do I implement fuzzy searching for a word within a field?
I have some very basic beginner SQL knowledge. I've come across SOUNDEX and LIKE and have tried to implement them in my code.
In my database, I have a names column that contains all available names for a person (first, second, third, etc).
So far it looks like this:
SELECT names, date_of_birth, information
FROM person_list as p
WHERE ((SOUNDEX(%s) = SOUNDEX(names)) OR (names LIKE CONCAT('%', %s, '%')))
This only works if the input is the full name. For example, say I had a field with 'John Smith', if I searched 'Jon Smyth', this would work fine.
However, if I wanted to only search 'Smyth', nothing would come up. And if there was a field containing 'John Thomas Smith' I wouldn't be able to search for 'Jon Smyth' and have that field come up.
How do I fuzzy search for a word or multiple words within a field? (I am also open to finding a solution using Python which I am more comfortable with!)
Thanks in advance!
Solution 1:[1]
Use:
.menu {
display: flex;
}
Solution 2:[2]
This is how I mainly center my navbars, just use the display: flex and justify-content: to either space out the elements or center them.
More info on the flex property
.menu{
list-style: none;
display: flex;
justify-content: space-evenly;
}
Solution 3:[3]
I added padding for space and removed the default list styling, hope this helps:-
.navbar {
display: flex;
align-items: center;
top: 0px;
}
.navbar ul {
display: flex;
}
.navbar ul li {
list-style: none;
}
.navbar ul li a {
display: block;
padding: 5px 22px;
text-decoration: none;
}
<nav class="navbar">
<div class="logo">
<a href="#">Roulathul <span>Uloom.</span>
</a>
</div>
<ul>
<li class="item"><a href="#Home">About</a></li>
<li class="item"><a href="#Services">Services</a></li>
<li class="item"><a href="#Clients">Skills</a></li>
<li class="item"><a href="#Contact Us">Teams</a></li>
<li class="item"><a href="#Contact Us">Contacts</a></li>
</ul>
</nav>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | josegp |
| Solution 2 | d4nky |
| Solution 3 | Mrigank Vashist |
