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

Julio Fraire julio.fraire at gmail.com
Sat Dec 31 00:48:06 CET 2011


Not at all, I guess it will be done over the weekend.

Julio

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

> Yes, I agree with you. I was only thinking of the case where there is
> only 1 search field. Given a single search field, the default behavior
> I think would be nice is if your plugin split on whitespace in the
> search field and AND'ed the terms together in the corresponding
> generated SQL. Unless the search terms were surrounded by quotes.
> Would this be hard to add?
> -Naveed
>
> On Fri, Dec 30, 2011 at 5:13 PM, Julio Fraire <julio.fraire at gmail.com>
> wrote:
> > 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/cffb2392/attachment-0001.htm>


More information about the Dancer-users mailing list