Skip to main content.
home | support | download

Back to List Archive

Re: [swish-e] Swish::Filter not working?

From: <amscopub-pcshop(at)>
Date: Tue Jul 15 2008 - 15:07:20 GMT
OK, I just installed LibMagic... it's a wrapper for libmagic which is a wrapper for an upgraded file command. The new file command is much better than the original but still not perfect. For example, scribus files are reported as ascii text when in fact they are not. However, svg files are now correctly reported as image files. Thanks again for the tip. I will be using this to find the file type when Swish::Filter can't figure it out from the extension.

 --Thanks and God bless!

Uriel Avalos

----- Original Message ----
From: Bill Moseley <>
To: Swish-e Users Discussion List <>
Sent: Monday, July 14, 2008 2:21:16 PM
Subject: Re: [swish-e] Swish::Filter not working?

On Mon, Jul 14, 2008 at 10:21:35AM -0700, wrote:
> Is it not working or am I misunderstanding what it's supposed to do? Here's what I did:
> I ran the existing on some simple files:
>     plain.txt
>     picture.jpg
> worked as expected. (Plain.txt was indexed and picture.jpg was skipped because it's a binary.) However, changing the filenames to:
>     plain.txt => fake.jpg
>     picture.jpg => fake.txt
> completely threw off Swish::Filter. The plain.txt file was no longer indexed and the fake.txt was indexed.
> Isn't Swish::Filter supposed to be using mime types to determine the file type? (and not the extension?)

Yes, it uses content type, but those are coming from the extension.
It only uses the perl module MIME::Types which is a simple lookup.

I think at one point I was using File::LibMagic, but that requires
having the libmagic and database installed which was probably too
restrictive for some users and requires inspecting each file.

Really, SWISH::Filter probably should look for File::LibMagic first,
then try MIME::Types as a fallback.

You could easily hack your version to use that module if you need that
ability now.

Bill Moseley

Unsubscribe from or help with the swish-e list:

Help with Swish-e:

Users mailing list

Users mailing list
Received on Tue Jul 15 11:07:19 2008