[support] CCK Field Search

Larry Garfield larry at garfieldtech.com
Tue Jun 3 01:37:05 UTC 2008


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.

-- 
Larry Garfield			AIM: LOLG42
larry at garfieldtech.com		ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson


More information about the support mailing list