Note that there are some explanatory texts on larger screens.

plurals
  1. PORedirect misspelled search php
    primarykey
    data
    text
    <p>I have a website where I index information about movies. To find a movie the user can input the title of the movie and this query will be sent to the database:</p> <pre><code>SELECT IMDB, Name, Year, Views FROM Movies WHERE Name LIKE '%$search%' </code></pre> <p>I used the "similar_text" function to solve little mistakes. For example if the name is "Pulp Fiction" and the user types: "Pulp Foction", since I don't get any results I run this little code for every movie.</p> <pre><code> similar_text($search, $Name, $percent); if ($percent &gt; $ValMax) { $ValMax = $percent; $PosMax = $i; } </code></pre> <p>I'm using this code since I only have a couple hundred movies in the database and in the future it's going to be at max about twenty thousand. Also every movie as a title of an average of 20 characters, without considering movies like <a href="http://en.wikipedia.org/wiki/Dr._Strangelove" rel="nofollow">Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb</a></p> <p>The real problem starts with a query used by an user: "Capitan America" (italian for Captain America) where the name of the movie was "Captain America – Il primo vendicatore"</p> <p>Using the <b>Levenshtein</b> function I got horrible results where with the <b>similar_text</b> they were at least decent. You can see the full results of that query <a href="http://www.filmgratuiti.org/DaImplementare/mispelled.php?search=capitan+america&amp;submit=Vai" rel="nofollow">here</a>. I made up this page to see for each search what the levenshtein and the similar_text would be.</p> <p>The movie that would have been selected if I didn't place a 60% blockage would have been "C'era una volta in America" (Once upon a time in America).</p> <p>However "Capitan America" and "Captain America" are pretty similar so I was wondering if there was a way to maybe check for each word. I've also heard about Lucene but I didn't know how to start from and If it was suited for my needs.</p> <p>Thanks :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload