You could do wildcard on both file name and the extension:
Model.search :conditions => {:filename => '(*myImage* (*jpg | *png | *gif))'}
Personally, I would add another column with the file type, to make filtering on
that a bit simpler.
Cheers
--
Pat
On 24/06/2010, at 4:14 AM, gmoniey wrote:
> I browsed the posts here, and noticed that Sphinx does not support
> regexes, but I was wondering if there is a similar technique to
> perform the search i want.
>
> Essentially I have a table of files, and I want to be able to search
> by filename, and place restrictions on the file type. For example,
> lets say we only want to search within images, so valid file types
> would be .jpg, .gif, .png, etc.
>
> So if I was searching for 'myImage' the regex would look something
> like (not fully tested): /.*myImage.*\.(jpg|png|gif)$/i
>
> Is there a similar technique, or am I forced to do a regular sphinx
> wildcard search: *myImage*, and do the filters after the fact?
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Thinking Sphinx" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/thinking-sphinx?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/thinking-sphinx?hl=en.