Global Search

I’ve been trying to add a global search function to an admin area with
mixed results. Right now it’s on the index page only and works fine.
Log in and view the admin area at http://anoptic.com/MAR/client/.

My thinking was that I could make it global by moving the function
outside of the switch statement in the controller which didn’t work. I
also tried adding PublicSearch to each case (view and edit) but
nothing. Here’s the controller as it is currently (no global search). <http://pastie.org/398696

.

Todd


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

What I would do is this. If you want to search within a particular model, then simply add a new case to your switch statement for ‘search_results’ or something like that. Make sure that your search engine points at that. If you want to be able to search across more than one model, then you need to have an application_controller.php (this is useful for other things, too – it’s a helpful place to stash a home page, about this site, contact us, whatever). In that controller, you can do something similar to this:

http://pastie.org/399660

Pay attention to the $places array. This sets up which models to search, and then provides a column name for each model (unless you have given all of your models a column in common, you’re going to have a hard time linking to the results). This array is set up as ('model_name' => 'column_to_link_by') format.

Walter


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I only need to search one model (‘mar’). The intent was to replicate
the search feature on the admin index page in the ‘view’ and ‘edit’
pages as well. The current ‘index’ case with search, <http://pastie.org/399889

.

As you also suggested, I tried adding a new case (‘search_results’) <http://pastie.org/399887

at the bottom of the switch statement which I thought would allow
me to search from any of the 3 cases (index, view, edit) but it’s not
quite there.

Todd

On Feb 25, 2009, at 7:54 AM, waltd wrote:

If you want to search within a particular model, then simply add a
new case to your switch statement for ‘search_results’ or something
like that. Make sure that your search engine points at that.


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

This will work, as long as your search field (probably either hard-
coded in /views/index.php or set as a global variable in
config.inc.php) is pointed to http://yourhost.com/mar/search_results .
If it isn’t, then depending on how it was created in the first place,
you can make the change so that it does point there. After that, this
should work fine.

If there is a variable called $search then try defining it again
inside the view and edit cases (overloading the variable) so that it
points where you want it to.

Walter

On Feb 25, 2009, at 12:54 PM, Todd wrote:

I only need to search one model (‘mar’). The intent was to replicate
the search feature on the admin index page in the ‘view’ and ‘edit’
pages as well. The current ‘index’ case with search, <http://pastie.org/399889

.

As you also suggested, I tried adding a new case (‘search_results’) <http://pastie.org/399887

at the bottom of the switch statement which I thought would allow
me to search from any of the 3 cases (index, view, edit) but it’s
not quite there.

Todd

On Feb 25, 2009, at 7:54 AM, waltd wrote:

If you want to search within a particular model, then simply add a
new case to your switch statement for ‘search_results’ or something
like that. Make sure that your search engine points at that.


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

The search field in the template, /views/index.php, is pointed at

<?=$_SERVER['REQUEST_URI']?>

The config.inc file:
<http://pastie.org/400031>

Todd

On Feb 25, 2009, at 1:11 PM, Walter Lee Davis wrote:

This will work, as long as your search field (probably either hard-coded in /views/index.php or set as a global variable in config.inc.php) is pointed to http://yourhost.com/mar/search_results . If it isn’t, then depending on how it was created in the first place, you can make the change so that it does point there. After that, this should work fine.

See if this helps:

http://pastie.org/400040

Walter

On Feb 25, 2009, at 2:27 PM, Todd wrote:

The search field in the template, /views/index.php, is pointed at

<?=$_SERVER['REQUEST_URI']?>

The config.inc file:
http://pastie.org/400031

Todd

On Feb 25, 2009, at 1:11 PM, Walter Lee Davis wrote:

This will work, as long as your search field (probably either hard-
coded in /views/index.php or set as a global variable in
config.inc.php) is pointed to http://yourhost.com/mar/
search_results . If it isn’t, then depending on how it was created
in the first place, you can make the change so that it does point
there. After that, this should work fine.


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Close but still not quite there yet. If you look in the Beanstalk repo
you’ll see the updated files in /trunk/admin/

Let me know if you need the link again.

Todd

On Feb 25, 2009, at 1:34 PM, Walter Lee Davis wrote:

See if this helps:

http://pastie.org/400040


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I looked, and I’m not sure what you’re up to there. I’ll take another look at the larger picture in a couple hours. It looks like you’re doing a couple of different things at the same time to try to fix it, and missing as a result.

Walter


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

To be more specific, the changes I made in the repo (/trunk/admin/) only involve the config, controller and index template files and should reflect what’s shown at the pastie link below. I’ve been using the Big Book™ and been slowly chipping away at it. I’ve found some of my errors but I’m still not there yet.

T.

On Feb 25, 2009, at 1:34 PM, Walter Lee Davis wrote:

http://pastie.org/400040

On Feb 26, 2009, at 5:34 AM, waltd wrote:

I’ll take another look at the larger picture in a couple hours. It looks like you’re doing a couple of different things at the same time to try to fix it, and missing as a result.

If you have this in your mar_controller.php:

http://pastie.org/403039

and you have routed your requests for yourdomain.com
search_results to the mar_controller (which is the default for that
URL, unless you have something else going on in your routing.php that
is “hijacking” search requests deliberately), then you should see
results in your page.

Walter

On Feb 27, 2009, at 4:33 PM, Todd wrote:

To be more specific, the changes I made in the repo (/trunk/admin/)
only involve the config, controller and index template files and
should reflect what’s shown at the pastie link below. I’ve been
using the Big Book™ and been slowly chipping away at it. I’ve found
some of my errors but I’m still not there yet.

T.

On Feb 25, 2009, at 1:34 PM, Walter Lee Davis wrote:

http://pastie.org/400040

On Feb 26, 2009, at 5:34 AM, waltd wrote:

I’ll take another look at the larger picture in a couple hours. It
looks like you’re doing a couple of different things at the same
time to try to fix it, and missing as a result.


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I’m just not seeing where the problem is. I’ll continue looking. Must
be something simple I’m overlooking.

T.

On Feb 28, 2009, at 8:43 AM, Walter Lee Davis wrote:

If you have this in your mar_controller.php:

http://pastie.org/403039

and you have routed your requests for yourdomain.com
search_results to the mar_controller (which is the default for that
URL, unless you have something else going on in your routing.php
that is “hijacking” search requests deliberately), then you should
see results in your page.


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options