Skip to main content.
home | support | download

Back to List Archive

Re: Getting the right files indexed the right way

From: Bill Moseley <moseley(at)not-real.hank.org>
Date: Wed Jan 28 2004 - 18:35:23 GMT
On Wed, Jan 28, 2004 at 03:13:36AM -0500, Rob de Santos AFANA wrote:
> with something like this:
> 
>     return 1 if !$content_type || ($content_type =~ m!^text/!); 
>     if $uri_ext =~ /\.(gif|jpg|jpeg|png)?$/ {
>          $$content_ref = $uri;
>          return 1;       
>     }

That won't work because those image files are likely not text/* content
type.

There should always be a content type coming from the server.  There's a
number of ways to do this, of course.  If you are using SWISH::Filter
then after calling $filter->convert() do:

   if ( $doc->is_binary ) {
       $$content_ref = $uri;  # stringify the URI object into the path
       return 1;
    }

No, the is_binary() method simply checks if the content type is not
text/*.  If you just want images then do something like

    if ( $content_type =~ /^image/ ) {
        $$content_ref = $uri;
        return 1;
    }

-- 
Bill Moseley
moseley@hank.org
Received on Wed Jan 28 10:35:23 2004