Dancer::Plugin::SQLSearch
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
On Fri, Dec 30, 2011 at 4:11 PM, Julio Fraire <julio.fraire@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
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@gmail.com>wrote:
On Fri, Dec 30, 2011 at 4:11 PM, Julio Fraire <julio.fraire@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
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@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@gmail.com> wrote:
On Fri, Dec 30, 2011 at 4:11 PM, Julio Fraire <julio.fraire@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
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@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@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@gmail.com> wrote:
On Fri, Dec 30, 2011 at 4:11 PM, Julio Fraire <julio.fraire@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
Hello, I have uploaded %subj% in http://search.cpan.org/~koceasy/Dancer-Plugin-I18N-0.12/lib/Dancer/Plugin/I1.... This plugin provides Intenationalization for Dancer. First i use Frank's plugin I18n from this https://github.com/franckcuny/dancer-plugin-i18n, but this plugin is very simple. Next i make plugin which is more similar as Catalyst::Plugin::I18N. This plugin supports mo/po files and Maketext classes under your application's I18N namespace. Bye Igor Bujna
This is awesome. Now I could write multi-lingual websites much MUCH easier! Thank you! :) On Wed, Feb 22, 2012 at 4:32 AM, <igor.bujna@post.cz> wrote:
Hello, I have uploaded %subj% in http://search.cpan.org/~koceasy/Dancer-Plugin-I18N-0.12/lib/Dancer/Plugin/I1... . This plugin provides Intenationalization for Dancer. First i use Frank's plugin I18n from this https://github.com/franckcuny/dancer-plugin-i18n, but this plugin is very simple. Next i make plugin which is more similar as Catalyst::Plugin::I18N. This plugin supports mo/po files and Maketext classes under your application's I18N namespace. Bye Igor Bujna _______________________________________________ Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
Great news! Thank you. 2012/2/22 <igor.bujna@post.cz>:
Hello, I have uploaded %subj% in http://search.cpan.org/~koceasy/Dancer-Plugin-I18N-0.12/lib/Dancer/Plugin/I1.... This plugin provides Intenationalization for Dancer. First i use Frank's plugin I18n from this https://github.com/franckcuny/dancer-plugin-i18n, but this plugin is very simple. Next i make plugin which is more similar as Catalyst::Plugin::I18N. This plugin supports mo/po files and Maketext classes under your application's I18N namespace. Bye Igor Bujna _______________________________________________ Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
-- Sergiy Borodych
wonderfull news. Thank you 2012/2/22 Sergiy Borodych <sergiy.borodych@gmail.com>:
Great news! Thank you.
2012/2/22 <igor.bujna@post.cz>:
Hello, I have uploaded %subj% in http://search.cpan.org/~koceasy/Dancer-Plugin-I18N-0.12/lib/Dancer/Plugin/I1.... This plugin provides Intenationalization for Dancer. First i use Frank's plugin I18n from this https://github.com/franckcuny/dancer-plugin-i18n, but this plugin is very simple. Next i make plugin which is more similar as Catalyst::Plugin::I18N. This plugin supports mo/po files and Maketext classes under your application's I18N namespace. Bye Igor Bujna _______________________________________________ Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
-- Sergiy Borodych _______________________________________________ Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
Le 22 février 2012 03:32, <igor.bujna@post.cz> a écrit :
I have uploaded %subj% in http://search.cpan.org/~koceasy/Dancer-Plugin-I18N-0.12/lib/Dancer/Plugin/I1.... This plugin provides Intenationalization for Dancer. First i use Frank's plugin I18n from this https://github.com/franckcuny/dancer-plugin-i18n, but this plugin is very simple. Next i make plugin which is more similar as Catalyst::Plugin::I18N. This plugin supports mo/po files and Maketext classes under your application's I18N namespace. Good news. It's very cool. Many thanks.
-- \0/ Hobbestigrou site web: erakis.im
participants (7)
-
Angel Arancibia -
igor.bujna@post.cz -
Julio Fraire -
Natal Ngétal -
Naveed Massjouni -
sawyer x -
Sergiy Borodych