Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-12-30 23:12:22

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 7,498
Website

smd_fuzzy_find: making search results less precise

After a millennia in beta it’s time for this plugin to hit the mainstream. Used in conjunction with the existing <txp:if_search /> tag it can offer a lifeline to people who type badly or mis-spell search terms. It offers alternative (hopefully close) matches of words it thinks were really meant and also lists article excerpts to show the matches in context.

The docs explain how it all works. It’s not perfect and is a little rough round the edges as the old beta thread shows; if anyone has any ideas on how to fix the current crop of known issues or any improvements / weird bug reports, please post them here. Bear in mind I don’t have a scooby how the fuzzy find algorithm that I stole borrowed off the Internet works. Answers on a postcard please.

Give the plugin a spin and let me know how you get on.

Revision history
————————

All available versions and changes are listed here. Each entry indexes the relevant post(s) in this thread (or the beta thread) to learn about the features.

Last edited by Bloke (2009-04-11 21:09:24)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#2 2007-12-31 09:19:48

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,146
Website

Re: smd_fuzzy_find: making search results less precise

Hi Stef.

I use smd_fuzzy_find since august and [as I said in an another thread] it’s a fantastic plugin. I’ll go to upgrade with this official version.

Thanks lot Stef.

Just one question. Do you still work on a watermark plugin? :)

Best regards,


Patrick.
Txp Tricks & Tips by french users : http://txp-fr.net | G+
Github

Offline

#3 2007-12-31 09:33:54

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 7,498
Website

Re: smd_fuzzy_find: making search results less precise

Pat64 wrote:

I use smd_fuzzy_find since august and… it’s a fantastic plugin.

Thanks, glad it’s of use to you. Please report any odd behaviour here — I know it has its problems sometimes and I’d really like to track down and fix some of the more obscure “features”, shall we say :-)

Just one question. Do you still work on a watermark plugin? :)

Oops, thanks for the reminder, I’d forgotten about it. I’ll have a look at it in the New Year when I get time. It’s something I’m going to need for a site I’ll be working on this year so I’ll try and get it working and release it for you.

Happy New Year!

Last edited by Bloke (2007-12-31 09:35:22)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#4 2008-01-02 20:14:49

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,146
Website

Re: smd_fuzzy_find: making search results less precise

Oops, thanks for the reminder, I’d forgotten about it. I’ll have a look at it in the New Year when I get time. It’s something I’m going to need for a site I’ll be working on this year so I’ll try and get it working and release it for you.
Happy New Year!

Fine Stef.

Happy new year for you too mate :)

Best regards,


Patrick.
Txp Tricks & Tips by french users : http://txp-fr.net | G+
Github

Offline

#5 2008-01-23 00:19:58

Els
Admin
From: The Netherlands
Registered: 2004-06-06
Posts: 7,451
Website

Re: smd_fuzzy_find: making search results less precise

Hi Stef,

I don’t know how I missed this thread ;) I just updated and, just like I (think I) did in the previous version, I modified the code to display the message in Dutch. I can change it like this:

	$smd_fuzz_str = array(
		'too_short' => 'De tekst waarnaar je zoekt is waarschijnlijk te kort. Probeer een langer woord. ',
		'no_match' => 'Sorry, geen resultaten gevonden die exact overeenkomen met "{search_term}". ',
		'suggest' => 'Hier zijn wat {thingies} die in de buurt komen en misschien helpen te vinden wat je zoekt: ',
		'suggest_join' => 'and',
		'articles' => 'articles',
		'words' => 'words',
	);

and it still works – though of course ‘words and articles’ is still in English, but when I try to change those, the output on my search page ends after the ‘suggest’ string. So it displays:

Sorry, geen resultaten gevonden die exact overeenkomen met “blahblah”. Hier zijn wat woorden en artikelen die in de buurt komen en misschien helpen te vinden wat je zoekt:

but no suggestions and no search results. Maybe I just don’t remember how I did it before? Am I overlooking something?

EDIT: I found that I can change everything but ‘articles’.

Another edit: debug="1" shows this:

(status IN ('4','5')) AND (section IN ('artikelen'))

but also when I don’t change ‘articles’ in the code, so probably not important.

Edit again (sorry, I should really do some more testing before posting!):

  • it works as it should if I only change ‘and’
  • if I change ‘and’ and ‘words’, it displays the search results but not the suggestions
  • if I change ‘and’ and ‘articles’ it displays the suggestions but not the search results
  • if I change ‘words’ and ‘articles’, or all three, it doesn’t display suggestions nor search results

I’m beginning to see a kind of logic here. And I understand that I am probably not supposed to change anything in the plugin code, but I don’t want to install the MLP pack only for this plugin, and it worked before… and I just enjoy testing ;)

Last edited by Els (2008-01-23 01:05:01)


<txp:Els /> ;)
Tag Reference | Unexpected behaviour? Check the tag trace | Still no clue? Check the names of your custom fields

Offline

#6 2008-01-23 01:12:15

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 7,498
Website

Re: smd_fuzzy_find: making search results less precise

Els wrote:

‘words and articles’ is still in English, but when I try to change those, the output on my search page ends after the ‘suggest’ string.

Hahaha! What a chump I am, sorry. I’d inadvertently converted the MLP strings to their “localized” content before I’d finished using them in the plugin. Hence, as you found, it looked in the code for variables named “artikelen” and “woorden” which of course are just double-dutch to the plugin :-P

Try v0.11 instead and let me know how you get on.

Sorry for the screw up, and thanks for finding the bug!


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#7 2008-01-23 01:18:10

Els
Admin
From: The Netherlands
Registered: 2004-06-06
Posts: 7,451
Website

Re: smd_fuzzy_find: making search results less precise

Yay, it works! I was almost convinced that I was being punished for messing with your code ;) Thank you Stef, you are the fastest replying plugin author I know!!


<txp:Els /> ;)
Tag Reference | Unexpected behaviour? Check the tag trace | Still no clue? Check the names of your custom fields

Offline

#8 2008-01-23 01:42:55

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 7,498
Website

Re: smd_fuzzy_find: making search results less precise

Els wrote:

Yay, it works! I was almost convinced that I was being punished for messing with your code ;)

lol, when my code starts to exhibit true AI is when you should worry about that ;-)

Thank you Stef, you are the fastest replying plugin author I know!!

No probs, happy to help. I’m probably also in the top 10 plugin authors with the least sleep… which might explain why I let bugs like that out in the first place :-o

Thanks again for spotting it.

*stef sidles away, head low, muttering "must test more, must test more..." *


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#9 2008-04-01 13:31:17

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 7,498
Website

Re: smd_fuzzy_find: making search results less precise

Minor update that is only of significance if you update smd_lib to v0.32 (the new smd_slimbox requires it).

With the latest version of smd_lib you will need v0.12 of smd_fuzzy_find [ compressed version ]

Some stuff has just moved from smd_lib to the plugin; no other changes to the code have been made.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#10 2008-07-29 10:53:08

whocarez
Plugin Author
From: Germany/Ukraine
Registered: 2007-10-08
Posts: 198
Website

Re: smd_fuzzy_find: making search results less precise

Hello,

on my site often occurs a problem with the plugin.
If I set “tolerance” greater than “1”, I get frequently a “Fatal error: Maximum execution time of 30 seconds exceeded”. I think the solution is clear: I have to set a greater value as execution time. Something like that

ini_set("max_execution_time","false");

or

set_time_limit(xy);

But where in the source code, I can put this line in to be recognized at execution time?

thanks

Offline

Board footer

Powered by FluxBB