Hello Miroslav and thanks for the great module.
Before opening this ticket I read all relevant issues but could not find an answer there.
As i understood Search Autocomplete can search for words in node titles (views-->nodes-autocomplete), in body text (views-->words-autocomplete) or in taxonomy terms.
But how can one create a view that searches for everything? That is, search among node titles, node body and taxonomy terms.
Is this even possible taken that our custom view can include only one filter - you mentioned that "the view has to expose one filter to its user". When I try to add 2 filters, I am not allowed to use the same "Filter Identifier (=filter)" and therefore Search Autocomplete stops working.
Thanks in advance for your time.
Comments
Comment #1
pipicom CreditAttribution: pipicom commentedComment #2
Dom. CreditAttribution: Dom. commentedHi pipicorn,
The issue you expose is more a Views issue than a Search Autocomplete issue in the way that you are looking at how to create a view to make this happen. Once the view is done, this module can handle it's reply.
I actually have talked about it multiple times, but never did a real use case example (I shall -once I got some time- do a poper documentation on the particular topic).
Views is just a way to perform DB request for people without coding skills. But the best, easy and efficient way to do what you want is actually to create a small custom module that would provide a callback URL (though hook_menu).
This callback method will perform all the necessary DB requests to all your necessary informations (nodes, taxonomies, products, users, whatever...) and will generate the json output, compatible with the Search Autocomplete expected syntax.
Once you have created this submodule, you can enable it and configure Search Autocomplete to use this custom callback rather than a view... hence retrieve all the informations you wanted.
Dom.
Comment #3
pipicom CreditAttribution: pipicom commentedThank you Dom for the clear answer.
Comment #4
trenttati CreditAttribution: trenttati commentedI recently used a Views "Global: Combine fields filter" to search within two different fields with Search Autocomplete. Using relationships you should be able to pull in all of your entities into a view and use a combined fields filter to search within all of them. The performance hit may be very large depending on how many entities you have.
If you have the ability, Dom's custom module suggestion is the better solution to your question.
Comment #5
dakku CreditAttribution: dakku as a volunteer commentedI am also using the Global: Combine fields filter - works very well.
Comment #6
Dom. CreditAttribution: Dom. commentedCould you eventually export the view, so I can make a "HOW-to" in documentation ? Maybe even include it from start at module install !
This is probably the most requested feature / question ^^
Comment #7
dakku CreditAttribution: dakku as a volunteer commentedDom, good idea. I will roll up something for you
Comment #8
trenttati CreditAttribution: trenttati commentedHere are my steps reduced to the bare necessities:
Comment #9
Dom. CreditAttribution: Dom. commentedOww... Sorry I did not understand the scope of this ! Then it is the second most wanted HOW-TO ! First behing "how to find everything within one view : users, taxonomies, nodes, etc..." ! :)
Comment #10
Dom. CreditAttribution: Dom. commentedComment #11
ressa CreditAttribution: ressa as a volunteer commentedHi @dom. - I think it's very interesting what you write in #2, about a custom module which will allow searching in several fields, not just the Title field. Is there any chance that such a module will at some point be included, if you have the time to write it? :-)
Comment #12
ressa CreditAttribution: ressa as a volunteer commentedI just realized that it is possible to search in the Body field, by updating the autocompletion_callbacks:
FROM:
autocompletion_callbacks_nodes::nodes_autocompletion_callback
TO:
autocompletion_callbacks_words::words_autocompletion_callback
But I find the behaviour is a bit strange - to get a node listed in the suggestion list, I have to type the exact word...
Is it not possible to get a more "Google"-like effect, so that if I start writing for example "eco", it will suggest "ecology", "economics","economy", and so on?
Comment #13
W01F CreditAttribution: W01F commentedI'm also very much interested in allowing my users to search for content either by node title or body body content AND other users via the same search bar. Currently they can only search for content via keywords in the node title - I also found the words behavior fairly unhelpful as the contained terms had to be an exact match to bring up results. And to search for users they have to go to a completely different views directory page I set up with an exposed filter for username.
I'm not well versed enough to code the module for this myself, but would find (as I recon many others would) such an all-encompassing search option module extremely useful.
Comment #14
syammohanmp CreditAttribution: syammohanmp at Zyxware Technologies commentedSee the below structure
Content type: College
Field Category: Music, Media, etc
Field Country: US, UK, Canada, etc
How can I get the below autocomplete suggestions.
College for Music, College for Media, etc , Music College in Uk ?
Comment #15
Dom. CreditAttribution: Dom. commentedYou should write a custom callback for this.
Here is an example for it :
https://www.drupal.org/project/search_autocomplete/issues/3200019#commen...
Comment #16
lubwn CreditAttribution: lubwn commentedI used Search API to query all the content types / users / taxonomies I wanted to search for and then created a view of this search api indexed fields, adding "autocomplete callback" as json output and it looks like it works. You can even group those together to create a nice output on autocomplete.
Only downside is you need to have the fields indexed, leading to bigger database but also I guess faster search times realtime.