[support] Drupal 7: Search Woes

Joel Willers joel.willers at sigler.com
Wed Apr 27 14:58:07 UTC 2011


I'd use Exposed Filters, personally.  If that doesn't work, you could always create a custom form and when you hit 'Search' it THEN runs the View (using the Views API) with those filters.  This method, of course, takes a bit of programming, but it isn't too hard, actually.

Here's an example from Views2 (You'll have to find the correct Views3 functions, if they've changed) that searched for items within 15 miles of the zipcode entered in the form:

(set $zipcode to the $_POST information)

$view = views_get_view('name_of_view_example');
$view->exposed_input['distance'] = array('postal_code' => $zipcode, 'search_distance' => '15', 'search_units' => 'mile');

$displayview = $view->preview();
print $displayview;

Hope that helps some.

Joel 


-----Original Message-----
From: support-bounces at drupal.org [mailto:support-bounces at drupal.org] On Behalf Of Al Sessions
Sent: Wednesday, April 27, 2011 9:34 AM
To: support at drupal.org
Subject: [support] Drupal 7: Search Woes

Firstly, I'd like to thank everyone on this list. Just by my lurking
you guys have helped me solve problems I didn't even know I had.

As a Drupal enthusiast fighting through the learning curve (and loving
every second of it) I do occasionally hit a wall, and this is one of
those times. After trying a half dozen modules and pouring through
literally hundreds of drupal.org nodes, I am no closer than when I
started.

I have a content type with a slew of fields and some 30K nodes.

I would like to make this searchable by field -- Last Name, First
Name, DOB, DOD, etc. -- with a themed search form to match. You know,
"search by last name", "search by first name", and so on. Faceted
search, while a nice idea, isn't necessary.

I've tried exposing Views filters without much luck (although if this
is the way to go, I'm happy to revisit Views, hopefully armed with a
handbook page or something) and tried the Search API ( I can't get it
to index anything). Finder just throws errors rather than results,
Search Lucene API isn't ported to D7 and SOLR isn't an option (shared
hosting for a non-profit).

This can't be an uncommon request and I'd be grateful for any pointers
in the right direction.

-- 
Al Sessions
-- 
[ Drupal support list | http://lists.drupal.org/ ]


More information about the support mailing list