I searched through the forums for this, so I hope I'm not reposting anything that has already been answered. I am creating a FAQ page that is just a simple view showing all of my FAQ content nodes which have two text fields, a question field and an answer field. I want to add search functionality to the view that searches through the question and answer field. This seems simple enough to just expose both fields which gives me two text search fields but I only want one search text field that just searches through both fields in the node. I wasn't sure if this can easily be done through the views 2 interface. If not, I know php but am new to the Drupal api so how would I go about making my own sql call to do this functionality. Thanks for any help in advance.
Chris
Comments
If you have the search
If you have the search module enabled, it looks like you can expose the search as a view filter. That might solve your problem...
------------------------------
http://fraggles.artsci.wustl.edu (Drupal user documentation and development blog)
Thanks, I'll try this out
Thanks, I'll try this out and let you know if it works.
Chris
www.stillrocksolutions.com
I tried enabling the search
I tried enabling the search module. Afterwards search comes up in the view's filter list. If I choose search it gives me three options. "Links from", "links to", "search terms". It looks like the basic functionality doesn't allow this to be done. I started searching through some other modules for searching but got held up with Drupal.org being down yesterday. I will continue to search for a module that would provide one search field for a view that can search two different cck fields. Any help in one that you already know, would be much appreciated.
The generic search module
The generic search module indexes all text content, so by default it would search all the cck fields. I just tried this myself using 'search terms'. If you expose it as a field and enter search terms into it, it searches all the fields within the nodes in the view - and only the nodes within the view. I had been using Views Fast Search in Drupal 5, but now this functionality is built right into search and views. It's very exciting.
Thanks your right
Thanks you were right. Only thing is that i have two content nodes that are shown in my view now. One has the word "cars" in the question field. The other has the word "cars" in the answer field. If i search for "cars" it brings up the first node and not the second. To make sure it is working i have the word "motor" in the second node's answer field and when searching for that it brought up the second node. I guess my question is if there is a way to bring up multiple nodes. Seems like a setting or something that I'm not seeing. The good news is that it is searching through the cck fields. here is my sql query when searching for "cars" which is in both content nodes but only shows the first.
Hm. You might want to check
Hm. You might want to check that it is actually 'cars' and not 'car' in the second field. I don't think Drupal's basic search supports 'messy' searches out of the box. If your content contains 'cars' it won't return if you search 'car' for example.
It works!
Thanks so much for your help. My issue was just that my site wasn't 100% indexed. I'm glad i realized this before diving into modifying the sql. Thanks again for your help on this.