I believe this question has been asked before, but I see no clear answer. I have a site with a simple CCK nodetype with a few text fields. We need to implement a 'scholarly' search whereby one can limit one's search by year, Volume, author, or limit his search to the Title field. We want something akin to the author, subject, date feature here:
http://scholar.google.co.il/advanced_scholar_search?hl=en&lr=
The Faceted Search module I believe may have this functionality, but neither the stable nor beta version will run correctly on the PHP 4 live server and even the stable one doesn't run on my local PHP 5 dev. server. :(
Faceted Search is quite a complicated module. My simple approach would be to just run a regular old text search based on the fields submitted. I would have to add an index or two, but aside from that, I think it would work.
Are there any better suggestions?
Thanks!
Try looking into views_fastsearch.module. It lets you leverage the search module's database for Views' exposed filters, creating a reasonably good facsimile of a per-field search.
On Sunday 01 June 2008, Fred Jones wrote:
I believe this question has been asked before, but I see no clear answer. I have a site with a simple CCK nodetype with a few text fields. We need to implement a 'scholarly' search whereby one can limit one's search by year, Volume, author, or limit his search to the Title field. We want something akin to the author, subject, date feature here:
http://scholar.google.co.il/advanced_scholar_search?hl=en&lr=
The Faceted Search module I believe may have this functionality, but neither the stable nor beta version will run correctly on the PHP 4 live server and even the stable one doesn't run on my local PHP 5 dev. server. :(
Faceted Search is quite a complicated module. My simple approach would be to just run a regular old text search based on the fields submitted. I would have to add an index or two, but aside from that, I think it would work.
Are there any better suggestions?
Thanks!
Try looking into views_fastsearch.module. It lets you leverage the search module's database for Views' exposed filters, creating a reasonably good facsimile of a per-field search.
I presume you mean to look into modifying the code, because AFAICT this module only provides a general search on all fields within the CCK nodes, but it can't be defined to search only only on one field.
On the other hand, in examining this, I have realized that I can create a view and expose a filter for each CCK field in question. This allows users to effectively search on those fields. The only issue now is to style the search fields and also, to set it up so that when the view first loads, no nodes appear (as opposed to ALL nodes appearing because no search terms were setup). For that I think I could hack the Views code.
Seems like this could be the easiest way actually. :)
Unless someone has a better idea.
Thanks, Fred
I have to admit I saw your message yesterday and didn't respond with the Views idea because I presumed you'd already considered it and dismissed it. Sorry! :-)
You could always expose the fields and have results returned "If Contains: Enter Keyword Here". Nothing will get returned AND you'll have a nice user friendly instruction already entered in the text box.
Neil
----- Original Message ----- From: "Fred Jones" fredthejonester@gmail.com To: support@drupal.org Sent: Monday, June 02, 2008 1:59 PM Subject: Re: [support] CCK Field Search
Try looking into views_fastsearch.module. It lets you leverage the search module's database for Views' exposed filters, creating a reasonably good facsimile of a per-field search.
I presume you mean to look into modifying the code, because AFAICT this module only provides a general search on all fields within the CCK nodes, but it can't be defined to search only only on one field.
On the other hand, in examining this, I have realized that I can create a view and expose a filter for each CCK field in question. This allows users to effectively search on those fields. The only issue now is to style the search fields and also, to set it up so that when the view first loads, no nodes appear (as opposed to ALL nodes appearing because no search terms were setup). For that I think I could hack the Views code.
Seems like this could be the easiest way actually. :)
Unless someone has a better idea.
Thanks, Fred -- [ Drupal support list | http://lists.drupal.org/ ]
You could always expose the fields and have results returned "If Contains: Enter Keyword Here". Nothing will get returned AND you'll have a nice user friendly instruction already entered in the text box.
I thought about that also. Then I would have to add a JS trigger to that field so that when they put the cursor there, that text goes away. To leave it there will be confusing for some users, especially those who won't know precisely how to remote it easily.
I suppose I will see which is easier then--edit the PHP or add a JS trigger.
Thanks
On Monday 02 June 2008, Fred Jones wrote:
Try looking into views_fastsearch.module. It lets you leverage the search module's database for Views' exposed filters, creating a reasonably good facsimile of a per-field search.
I presume you mean to look into modifying the code, because AFAICT this module only provides a general search on all fields within the CCK nodes, but it can't be defined to search only only on one field.
On the other hand, in examining this, I have realized that I can create a view and expose a filter for each CCK field in question. This allows users to effectively search on those fields. The only issue now is to style the search fields and also, to set it up so that when the view first loads, no nodes appear (as opposed to ALL nodes appearing because no search terms were setup). For that I think I could hack the Views code.
Seems like this could be the easiest way actually. :)
Unless someone has a better idea.
Thanks, Fred
There's no need to hack Views for that. (Really, don't, you'll live longer.)
I believe you want to set the default value of the filter to empty, and then "use default" on the exposed filter. Or something along those lines. It may vary with the field type, but I know it is possible to setup an "empty by default" View because I've done it before myself.
There's no need to hack Views for that. (Really, don't, you'll live longer.)
I believe you want to set the default value of the filter to empty, and then "use default" on the exposed filter. Or something along those lines. It may vary with the field type, but I know it is possible to setup an "empty by default" View because I've done it before myself.
I don't actually see any way to do that.
The hack works, however, and was pretty painless. Maybe 8 lines of code altogether.
Thanks.