Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Search with support for spelling mistakes
  • Hi guys! Together with Ronald Mansveld I've been working on an alternative to the current solutions for searching through data with the support for simple spelling mistakes. Today we'd like to introduce what we've been working on to make it happen: a Search package for FuelPHP. For all the info, checkout the github repository . It's far from perfect and we're not trying to replace Google Site Search or Apache's Lucence. We're just trying to offer all FuelPHP developers an easy way to have slightly more advanced search than the famous "LIKE %term%". And why would that have to be much harder than this?
    $products = Model_Product::find('all');
    
    $found_products = Search::find('shampoo')
        ->in($products)
        ->by('name', 'slogan')
        ->execute();
    

    The algorithm and mechanics can still be improved a lot and we're excited to hear about your ideas and see your awesome contributions coming in.
  • Small update and community request! We're working on support for multiple words and are in need of some outside input. Implementing the multiple word support complicates the search algorithms and it turns out to be come a balancing act between accuracy and performance (what doesn't, right?). We want to balance this package as well as we can, so we would like to hear from you guys what you plan to use this package for. What kind of datasets will you use, what kind of search terms will you be expecting and what kind of mistakes do you expect your users to be making? Are they product databases, or do you plan to search through articles? Will users misplace spaces anywhere or do you expect them to search for full sentences? I.e. we're working with a product dataset with weirdly spelled product names. We expect our users to make spelling mistakes more often than spelling it correctly. Also we expect spaces to be included where they shouldn't be! Any form of feedback is highly appreciated. Just some ideas, or entire datasets with entire search terms are accepted and very welcome. Every little bit will help into making this a properly usable package.
  • Seems really good. Thanks for that. Let us know when you implement multiple words support! :D
  • Glad you like it! We're working on the implementation of multiple words search term as we speak. We've got a pretty good solution that we can realise quickly and a good idea on how to make it work even better later on. Join the discussion at the github issue, can't wait to hear people's awesome ideas.
  • Hello, glad to hear about search for spelling mistakes.. I want to implement your package to my project. In short it will be creating surveys with a lof of functionality throught time (based on user datas and needs)...
    I want use your package for administrators and users too. User can search created surveys (title, intro and outro text) and for questions and answers... So there will be search for multiple tables...

    I haven´t implemented it yet.. So when first user data will be awailable (it takes time) i can let you know...
  • Hello,

    Great class here, works really well.

    Does this have support for counting the retrieved (matching) data/records, to use for pagination, similar to the usual ->count(); method?

    Kind regards,
    Christian

    UPDATE: Just used PHP's count function instead, seems to work just as well.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion