On Oct 27, 2006, at 2:10 PM, Kevin Walsh wrote:
Josh Lavin <suppressed> wrote:On Oct 26, 2006, at 5:29 PM, Kevin Walsh wrote:You are always returning a true value. A SearchOp's coderef needs to return true if a match is found or false if no match is found. Try something like this instead: CodeDef not_tags SearchOp CodeDef not_tags Routine <<EOR sub { my ($self, $i, $pat) = @_; $pat = qr/$pat/i; return sub { my $string = shift; $string =~ s:<[/\w].+?>::gi; return $string =~ $pat; }; } EORThanks, Kevin. That did the trick, but only after I made a change to Search.pm, which you mentioned here:http://www.icdevgroup.org/pipermail/interchange-users/2006-July/ 045747.htmlI was getting the same "Can't use an undefined value as an ARRAY reference" error. After making the change, I then started getting random bareword errors. When searching for 'berkey' (a real product), sometimes it would get the result, and other times this: Limit subroutine creation: Bad code: Bareword found where operator expected at (eval 1224) line 8, near "] aqberkey" syntax error at (eval 1224) line 8, near "] aqberkey " This is mentioned here:http://www.icdevgroup.org/pipermail/interchange-users/2004-June/ 039504.htmlOk. Perhaps I'll take a look into that at some point, but not right now. I assume you have a reasonably up to date Perl installation. I use the 5.8.8 version that comes with Gentoo GNU/Linux. There's probably not a lot of point looking into it if you have Perl 5.6.
I have Perl 5.8.7.
If you're using RPC mode then perhaps you should drop out of that, back to high/low traffic mode, and see if that helps.
Changing from RPC to High solved the problem. However, I removed the mv_column_op for the Text::Query module (aq), and now it works fine, even in RPC mode. :-)
Another thing, perhaps unrelated, is how to search multiple fields with a custom SearchOp and get it to work on all? E.g.: sf=description vs. sf=description,commentI think that should "just work". Have you tried it and verified that it fails? What happens when you try? What happens with "sf=*"?
Using more than one search field, or sf=*, or sf=:* with a custom SearchOp causes the search to fail. Maybe because it is now an array?
-- Josh Lavin Kingdom Design http://www.kingdomdesign.com/ _______________________________________________ interchange-users mailing list suppressed http://www.icdevgroup.org/mailman/listinfo/interchange-users
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.