[ic] Prevent search from matching on html

Josh Lavin josh at myprivacy.ca
Thu Oct 26 17:31:21 EDT 2006

Hello list,

I am finding that when we use HTML in our product descriptions, the  
search results will include products where an HTML tag matched the  
search query.

Simple example: if my description contains "<h2>Features</h2>" and  
someone searches for 'h2', then that product will be returned in the  

I would like to avoid this, and figured I needed a custom SearchOp,  
but I'm having no luck with this one:

CodeDef not_tags SearchOp
CodeDef not_tags Routine <<EOR
sub {
         my ($self, $i, $pat) = @_;

         return sub {
             my $string = shift;
             $string =~ s:<[/\w].*?\s?/?>::gi;
             return $string;

The idea is to remove any HTML tags before searching. Any ideas?

Josh Lavin
Kingdom Design   http://www.kingdomdesign.com/

More information about the interchange-users mailing list