Hi! =)
Im looking to create a single field (one search box) that will search many fields (3) that have already been exposed.
however the problem is that it offers multiple search fields (3) for me to search, but i just want one field that will search all 3.
---------------------------------------------------------------
Attempt solution 1:
with the search box i created i submitted it to a unique field in which it would take whatever search term it was, and put it into all 3 'GET' variables and it would search all 3 fields with that get variable.
eg. user enters in 'shirt', page goes to a unique php page, which puts shirt into the 3 other get variables, and then submits it back to the normal results page.. so it would have seemed as though the user typed 'shirt' into all 3 search boxes.
However, this meant that if an item didnt match one of those fields, it wouldnt show, even if 2 of them matched.. *doh*
---------------------------------------------------------------
Attempt solution 2:
one solution that DOES work on a limited way. was that i created my own unique page, with a connect to database, and took the query, and applied it to a 'SQL table VIEW' that i created in the database manually myself with these 3 values, so that if one value matched on a row, it would return.
This does work, however the drupal view i am applying it too, has a whole lot of attributes and taxonomies that are applied, (ubercart purchase form and varying size selections), which is beyond the scope of my sql knowledge and ability to understand the backend of drupal, in applying to creating my own manual view. I also need to review some serious security issues, having a connect to database in the middle of one of my pages...
---------------------------------------------------------------
Attempt solution 3:
When the user actually puts in the data when creating a node, (title, product code, description), they will have to put the title into the description and the code into the description. And ill have a single exposed field on the description, and all 3 terms are in their.
However.. :D the user will have to manually do this when they are creating the node (product).. and this is highly inconvenient and unprofessional, and could cause problems, when someone who does not know about this process, to not put the title and code into the description, and the search results will not be accurate. and mess up the whole system.
---------------------------------------------------------------
Any help would be greatly appreciated. This is the best solutions i could come up by myself for now. and ive had a solid many hours search on what would be the best way to merge filters.
Regards,
Stevo
--
also will pay $40 to the person who can resolve this issue.
Comments
So basically, at the moment,
So basically, at the moment, i have products.
3 search filters.
Title, Description and SKU (Product Code).
3 boxes..
And id like it like this..
This will search those 3 fields. and if one field matches it will show.. but will bring up the unique view for that product with the additional details (such as purchase form, weight, shipping, attributes etc etc.)
------------------------------------------------------------------------
Is their anyway to get access to a certain views query, so i can maybe merge the values... so i can add this at the end....
I had a look in the DB, to see if i could edit it, and its stored in BLOB..
Kind of solution
Well, I have a kind of solution for you. It's a bit unprofessionnal from a computing science guy point of view, but it does work and is of no inconvenience for the end-user (including the admin that enters products).
You install the "Computed Field" Module, and you create a computed field. Inside of it, you just aggregate the field you want to search on.
Example : $node_field[0]['value'] = strip_tags($node->title.' '.$node->body.' '.$node->nid);
If you have a CCK field, you put .$node->field_mycckfield[0]['value']. Note that I used strip_tags to get only plain text.
Then you can just expose this field in Views and it'll search on (here) title, body and nid at once.
The "bad" thing is that it stores things twice in the database.
hehe just came with the same
hehe just came with the same solution after looking all around. My combination of ProfileSearch and Content nodes doesn't work as intended.
Meetai - Drupal solutions
Great solution - filter multiple fields using computed field
Although the "bad" thing is the duplicated content, and for sure the right way to do it is to develop a specific view filter, still, this is a great and straight forward solution.
I had to filter for a node name, city and/or country. Having 3 separated fields, and having the country field as a long select box made ugly and not useful (although worked properly).
What I did was to add a computed field with title, city and country, and added it as an exposed filter with the "contains" operator.
It was also easy to implement an AJAX autocomplete out of it (with help from Sae - http://www.appnovation.com/how-implement-drupal-ajax-autocomplete), which made it even better - I added a view as the origin for the AJAX values, and added each value (title, city and country) by itself to the AJAX list as well.
The computed field I made:
The autocomplete:
This solution not only made my exposed filter simpler, but also allowed as easy was for a "smart" autocomplete...
Still, I am certain it can be done in other ways, maybe with better performance.
Any suggestions ?
Has anyone figured this out.
Has anyone figured this out.
I have built a browse user / search page and I want to be able to search buy keyword, profile fields and the user email address from one search box.
Any help would be appreciated.
Cheers,
Latte
See Finder (I think the dev
See Finder (I think the dev release), and install Finder User. Or use an exposed filter "Search" in Views.
Expose the Search: Search
Expose the Search: Search Terms filter ... lol i am shocked that it was that easy! muchoz thanks
BTW, Drupal's core Search
BTW, Drupal's core Search module must be enabled to have the "Search Terms" filter appear in views.
Use global filter populate...........
you can combine the different fields ....................