I am using php to search the file names of about 10,000 files. It works now, but for it to find the file the search phrase has to be found exactly within the file name. I would really like to get a fuzzy search feature workings, but things like similar_text() have crashed the site, I am assuming because they are so intensive. I have only tried similar_text and levenshtein. Any ideas are appreciated.

I am using php to search the file names of about 10,000 files. It works now, but for it to find the file the search phrase has to be found exactly within the file name. I would really like to get a fuzzy search feature workings, but things like similar_text() have crashed the site, I am assuming because they are so intensive. I have only tried similar_text and levenshtein. Any ideas are appreciated.

GREP can be your friend. Those preg functions might be able to pull off what you're looking for. For instance, you might put together a statement that takes vowels "/[aeiou]/" and replaces them with an identifier tag like "##" in both your query and your array of files. Then check each file for a preg_match. I suppose it's a bit complex a script, but it shouldn't at least crash.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.