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

Julio Fraire julio.fraire at gmail.com
Sat Dec 31 09:03:37 CET 2011


It's now in github.

Regards,

Julio

On Fri, Dec 30, 2011 at 11:16 PM, Julio Fraire <julio.fraire at gmail.com>wrote:

> I am still learning git... give me a chance to dig into github and I'll
> gladly upload it in there.
>
> Julio
>
>
> On Fri, Dec 30, 2011 at 10:11 PM, Naveed Massjouni <naveedm9 at gmail.com>wrote:
>
>> Awesome! I can't wait to start using this plugin. I could not find
>> this project on github. How would you prefer to receive patches and
>> stuff? RT?-Naveed
>> On Fri, Dec 30, 2011 at 8:02 PM, Julio Fraire <julio.fraire at gmail.com>
>> wrote:
>> > Well, that was a quick "over the weekend". The new version has been
>> uploaded
>> > a minute ago. The new default behavior is to AND search terms when the
>> > search is over a single database field.
>> >
>> > When the query is surrounded by double quotes it is not split to allow
>> for
>> > exact phrase searches.
>> >
>> > Julio
>> >
>> >
>> > On Fri, Dec 30, 2011 at 5:48 PM, Julio Fraire <julio.fraire at gmail.com>
>> > wrote:
>> >>
>> >> 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
>> >>> >
>> >>> >
>> >>
>> >>
>> >
>> >
>> >
>> > _______________________________________________
>> > Dancer-users mailing list
>> > Dancer-users at perldancer.org
>> > http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>> >
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20111231/181726b3/attachment.htm>


More information about the Dancer-users mailing list