[Dancer-users] Dancer::Plugin::SQLSearch

Julio Fraire julio.fraire at gmail.com
Fri Dec 30 23:13:30 CET 2011


Hi Naveed,

I think AND works nice if you have one search field only. OR works nicer if
you search across different fields.

Imagine this example: You have a table with people names, and you want to
search across fields "name" and "last_name". What happens if your user
looks for, say, John Smith? Using OR, the results will include records of
people whose name is John and their last name, Smith (or Johnson!). That
certainly includes John Foo and Bar Smith, and John Smith too. Using AND
you would likely get zero results.

However, if you were storing both words in the same field, and if your
search was performed only over a single field, then yes. AND works very
good.

So, it is probably a good idea to use AND if the list of your search fields
has only one element. Or this could be a new parameter to the search method
or a configuration option.

Thanks for your suggestion,

Julio

On Fri, Dec 30, 2011 at 3:19 PM, Naveed Massjouni <naveedm9 at gmail.com>wrote:

> On Fri, Dec 30, 2011 at 4:11 PM, Julio Fraire <julio.fraire at gmail.com>
> wrote:
> > Hola amigos!
> >
> > I have uploaded Dancer::Plugin::SQLSearch to CPAN, which is aimed to help
> > with the creation of simple search pages. Basically, it will take a
> search
> > query and turn it into a data structure suitable for SQL::Abstract. You
> then
> > supply a subroutine that takes this data structure and performs the
> actual
> > search in your database.
> >
> > From the plugin (and your search routine) you get the first page of
> results
> > and information to build pagination links. It also saves some info in the
> > session object to offer "back to search results" links for your
> destination
> > pages.
> >
> > Hopefully the documentation is clear enough for you to play with this
> little
> > plugin; the tests should offer some insight as well. I hope you find it
> > useful.
> >
> > Happy new year,
> >
> > Julio Fraire
> >
>
> This plugin looks awesome. Thanks for creating it. I have one
> suggestion. It makes more sense to me if the default behavior were
> that terms were AND'ed instead of OR'ed. So that a search for "orion
> belt" didn't return results for the kind of belt that holds your pants
> up.
> -Naveed
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20111230/2c70d672/attachment.htm>


More information about the Dancer-users mailing list