Skip to main content.
home | support | download

Back to List Archive

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

From: Bill Moseley <moseley(at)>
Date: Mon Jul 14 2008 - 18:21:16 GMT
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
Received on Mon Jul 14 14:21:17 2008