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.
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@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of Al Sessions Sent: Wednesday, April 27, 2011 9:34 AM To: support@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.
That looks way to easy :) *
Ryan LeTulle*
bayousoft http://twitter.com/bayousoft -twitter
On Wed, Apr 27, 2011 at 9:58 AM, Joel Willers joel.willers@sigler.comwrote:
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@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of Al Sessions Sent: Wednesday, April 27, 2011 9:34 AM To: support@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/ ] -- [ Drupal support list | http://lists.drupal.org/ ]
Thanks, Joel.
Exposed Filters was initially the way I wanted to go.
However, I can't seem to get Views to filter by fields.
I have a date_of_birth field (plain text) that seems unfilterable.
If I filter on node:title, there is no problem. I can expose the filter and get the results I want.
However, it doesn't seem to work with fields (I've tried several).
The code you provided seems simple enough, but I'm concerned about creating custom forms and embedding views. I don't know who is taking over this site and would far rather to everything from the GUI than programatically.
-------------------------------
On Wed, Apr 27, 2011 at 10:58 AM, Joel Willers joel.willers@sigler.com wrote:
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
Again, this is Views 2 that I'm using, but having set up a Content Type with additional CCK fields (Just a field in D7, if I recall). In D6 it's Content:name_of_field, in D7, I think it's Field:name_of_field.
Joel
-----Original Message----- From: support-bounces@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of Al Sessions Sent: Wednesday, April 27, 2011 3:58 PM To: support@drupal.org Subject: Re: [support] Drupal 7: Search Woes
Thanks, Joel.
Exposed Filters was initially the way I wanted to go.
However, I can't seem to get Views to filter by fields.
I have a date_of_birth field (plain text) that seems unfilterable.
If I filter on node:title, there is no problem. I can expose the filter and get the results I want.
However, it doesn't seem to work with fields (I've tried several).
The code you provided seems simple enough, but I'm concerned about creating custom forms and embedding views. I don't know who is taking over this site and would far rather to everything from the GUI than programatically.
-------------------------------
On Wed, Apr 27, 2011 at 10:58 AM, Joel Willers joel.willers@sigler.com wrote:
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