A Participants Database Add-On providing two different configurable multiple-field search capabilities.
Product Setup
The Combo Multisearch Plugin offers two main search control types: a single text input (like a search engine) or a set of selectors/checkboxes/text fields that provide a search term for each field. Both search types may be used, but in most cases, you’ll be using one or the other.
Setting up the Combination Search
Combo Search provides a single-input search that will look in multiple fields for a match to a single input. Use this search type in situations where a simple easy-to-use interface is desired to search the database.
To set up the Combo Search, you’ll need the names of all the fields you want searched with the user’s input. Type the names as a comma-separated list into the “Combination Search Fields” setting. To disable the combo search, leave the setting blank.
The “label” and “placeholder” settings give you two ways to prompt the user. The “label” is shown alongside the text input, and remains visible when the user types in their search. The “placeholder” is shown inside the text input, and disappears when the user begins to type in a search. A placeholder is good when you don’t need to explain much and want a clean, simple interface. The label is good for situations where you want to explain a little bit what the search is for. You can use either, neither, or both if you want.
Combo Search Modifiers
The “combo search modifiers” are a set of radio buttons to allow the user to set the type of search desired: “any,” “all,” or “phrase.” When enabled, these radio buttons will be shown next to the combo search input. There is a default search type that will be initially selected, and this is also the search mode that will be used if the combo search modifiers are not shown.
Autocomplete
“Autocomplete” is also known as “autosuggest” and provides the user with a list of suitable search terms. The list of suggested search terms is shown as a pop-up window when the user begins typing, and the list is pared down as the user types in more letters. The list of autosuggest words is drawn from the database, so it can reliably guide the user to search terms that will yield results. The fields that the autocomplete terms are drawn from is defined in the “Combo Search Autocomplete Fields” setting. It is a list of field names like the “combination search fields” setting. This means that the combo search can search on fields that don’t contribute to the autosuggest. This is helpful in cases where some of the fields searched contain blocks of text, which could add a lot of useless terms to the autosuggest list.
The terms that are available to the autosuggest are limited by the list shortcode filter, so data from records that are prevented from getting displayed won’t show up in the suggestion list.
Configuring the Multi Search
Multi Search provides a comprehensive interface for searching on multiple fields using a separate input for each field. This is best for situations where a precise, complex search is needed (such as a technical database) or in situations where you want to show the viewer what kind of information they can search by (for example, a services directory).
Starting with version 2.0, the multisearch fields are defined in a special interface under the “Multi Search Fields” tab in the plugin’s settings. In this new interface, each field in the multisearch can be customized in several different ways, changing how it looks, how the user may interact with it, and how it finds matches. Which options are available to a field depends on the type of field it is as defined in Participants Database.
If you already had Combo Multisearch set up and are updating from an older version, your fields will still be configured as before, only now you can fine-tune how each field works.
On this page, you configure which fields will appear in the multisearch and in what order. The display shows a list of all the fields configured for the Multi Search so you can edit the parameters of each one. You can add as many fields here as you want, you can also also delete and re-order them.
Note that fields that are included in the Combo Search configuration are not available for Multi Search; remove them from Combo Search to make them available in the “Add Field” selector.
Field Parameters
Each field in the list of fields has its own parameters where you can change how it is presented or how it works. There are several parameters, and which ones are available to each field depends on the field type. Here is a description of the parameters:
- Label – This defaults to the normal field title, but if you want to give it a different label in the search interface, you can do that here.
- Help Text – defaults to the field’s help text, but you can choose a different help text for the search interface.
- Attributes – allows the addition of HTML element attributes, such as the “required” attribute to selectively make fields required in the search interface.
- Input Type – depending on the original field type, there will be several different ways the field can be shown in the search interface.
- Include Label in Result Summary – when checked, the field’s label will be shown along with the searched-for value in the search result summary.
- Database Values in Selector – for any kind of selector input type, instead of showing the configured field options, the options shown in the control will be drawn from the database.
- Show “Any” Option – for selector input types, enabling this shows an option that will match any value in the database: this is essentially a “reset” for the selector, removing it from the search. Uncheck this if you want to force the user to make a selection.
- “Any” Option Label – when the “any” option is shown, this is how it will be labeled. You can leave it blank for a blank option.
- Multiselect “Or” Mode – (only for multiselect input types) if this is checked, the search result can match any of the values selected, instead of needing to match all of them when using “filter” mode. This setting makes no difference when not using filter mode because the values will be treated as an “or” in that case anyway.
Multi Search Field Input Type
Some field types will have several options available for the “Input Type” selected in the Multi Search Fields interface. A text field can be shown as a text input (of course) but also as a dropdown selector that shows a list of values taken from the database entries. Dropdown fields can be shown as a dropdown or as a multiselect, giving the user the ability to select several possible matches for that field.
Determining Which Multi Search Fields are Shown
Normally, a list shortcode configured to show the Combo Multisearch control will show all the fields you have configured in the Multi Search Fields interface. It is possible to determine on a per-shortcode basis which fields will be shown in the interface, as explained in the “Showing the Search Control” section. If you want to do this, you must configure all the fields you will show in all shortcodes, and then use the “search_fields” attribute in the shortcode to determine which of the configured fields to show in that particular display. In other words, you cannot add a field in the shortcode that has not been added to the Multi Search Fields configuration.
Filter Search Mode
The Combo Multisearch has two general modes of operation: Filter Mode on or off. With filter mode “on,” all chosen search values must match the record’s values for it to be included in a search result. If filter mode is “off,” a record will be included in the results if any of the provided search terms matches the record’s values.
When filter mode is on, any multi search fields that are configured with the “multiselect or” option will only require that one of the selected values in that field is a match. With “multiselect or” deselected, all the options selected for that field in the search must match.
Each search type, combo or multi, has a “Whole Word Match Only” switch so that text searches will only match a complete word in the search, not portions of a word. For multi-search controls, this only affects text inputs where the user types in the search term.
Searching on Date Fields
“Date” type fields can be presented as a single input or as a range with two inputs.
When using a single input, the search will attempt to include all records that correspond to the entered date.
When using the ranged inputs, the range will always include the date entered for the end of the range. For example, if the range is entered as “June 1, 2020” through “June 10, 2020” records that have a date of June 10, 2020 will be included in the result.
Partial Dates Supported
When using “date” fields in multisearch, it’s possible for users to enter partial dates, such as just the year, a month and a year, or just a month. For example “2010” will return all results with dates within that year. Entries like “March 2010” would return all dates within the month of March 2010. It’s als possible to enter a month: an entry of “May” will return all records with dates that are within the month of May in the current year. Partial dates can be used with ranged searches also: for example a search of “2000” through “2010” will return all dates between 2000 and 2010, inclusive.
When using a ranged input, if one of the inputs is left blank, it is assumed to be the current date. You can override this behavior by adding “required” to the attributes setting for the date field in the multisearch fields configuration.
Returning to the Search Results
Under the General settings tab is an option to enable restoring the previous search when returning to the search page. This is convenient for users who need to navigate away from the search page and wish to return to the same page of results. If this is unchecked, the search page will be reset every time it is loaded.
Showing the Combo Multi-Search Control
The Combo Multisearch Add-On provides its search capabilities through the use of a special template. There is a template for the list display and for the stand-alone search display. Once the plugin settings are defined, the template must be called in the shortcode like this:
[pdb_list template=multisearch ]
The plugin now also includes a table-less responsive template for the list multisearch shortcode:
[pdb_list template=multisearch-responsive ]
Or for the standalone search like this:
[pdb_search template=multisearch ]
If you are using the pdb_search shortcode, be sure to read Using the Search Shortcode as it can be tricky to configure.
It is possible to define the list of multisearch fields to search in the shortcode, drawn from the list of fields configured in the mutisearch fields setup. For example:
[pdb_list template=multisearch search_fields='company,city,state']
If you have both combo and multi searches configured, the combo search will only show if “combo_search” is included in the field list.
If you want a particular shortcode to show the combo search only, you can set that up like this:
[pdb_list template=multisearch search_fields='combo_search']
It is not possible to determine which fields are included in the combo search in the shortcode due to search optimization.
Setting Up a Remote Search
If you need to have the search control in a different location then where the results are displayed, you can do that with the [pdb_search] shortcode. You need to use the “target_page” attribute to tell the search shortcode where the results are to be displayed. The [pdb_list] shortcode is used to display the results. (Check this page for more on using the search shortcode…) For example, if your results are displayed on a page named “listings” then your search control shortcode will be like this: [pdb_search template=multisearch target_page=listings]
. That shortcode can be placed anywhere. If you want to put it into a sidebar widget, you’ll need a plugin that will allow a shortcode in a widget. Then, on the “listings” page, put [pdb_list]
. There is no need to set the template to multisearch unless you want another search control to appear at the top of the results.
Target Instance
In cases where the [pdb_list]
shortcode is on a page with other Participants Database shortcodes, you may need to set the “target_instance” attribute to target the specific list shortcode where you want the results to appear. To find the target instance value, you must inspect the HTML. At the top of the list display, you will see a classname in the wrapper such as “pdb-instance-2” That means the list is instance 2, and you would need to put that value as the target instance in the search control shortcode, like this: [pdb_search template=multisearch target_page=listings target_instance=2]
.
F.A.Q.
Can I use both the Combo Search and Multi Search at the same time?
Yes, you can, but the set of fields selected for the Combo Search Fields should be different than the fields configured in Multi Search Fields. It will still work, but the results might not be as expected because the combo search will override the multi search if both are searching on the same field.
Is it possible for the user's last used search to be restored when they return to the search page?
Yes, there is a setting under the “General” tab in the Combo Multisearch settings called “Remember the Last Search” and if checked, it will store the search parameters for the last search on the user’s browser. This means that even if they leave the site and come back later, the last search they used will still be there. If “Clear” is clicked the stored search is erased.
I want to pre-load the search terms when linking to the search page. How do I do that?
Yes, it is possible to place the search terms in the URL, and they will pre-load into the search form.
For Multi Search, each field you want to preload a search term into needs to be named and given a value. For example, you want to take the user to the search page set up to find all the brewpubs in Seattle. Your link would look something like this:
https://xnau.com/search/?city=seattle&business_type=brewpub
The “city” and “business_type” fields would then be filled with the vales in the URL. Of course, the fields named must be configured to appear in the Multi Search inputs.
You can do the same for the Combo Search, but there is only one field, named “combo_search” so if you wanted to do the same kind of thing as our example above, you could use a URL like this:
https://xnau.com/search/?combo_search=seattle%20brewpub
You’ll notice the %20 in the search term: this is code for a space, this is needed because URL’s cannot contain spaces. Take a look at this reference to learn more about using query strings in URL’s.
I want to combine Combo Multisearch with Locations Map to show search result locations in the map. How can this be done?
Right now this doesn’t work using the “auto placement” of the locations map. You can get it all working together using a custom template I’ve created a template that will do the job here:
https://gist.github.com/xnau/39afbf647d78e85a7acdba4b0da30530
You’ll need to download that template, and place it where Participants Database can find it. This is explained here:
Using Participants Database Custom Templates
Once that’s done, change your shortcode to something like this:
[pdb_list template=multisearch-map]
I've got a very large database, are there any problems with this plugin with large databases?
Mostly, the size of the database is not going to matter at all, MySQL is pretty efficient with large databases.
There is one setting that will be affected, that’s the “Autocomplete” feature of the Combo search. For a very large database, you could get some memory errors with this feature. Two things you can try for that problem: limit the number of of fields that are going into the autocomplete (using the “Combo Search Autocomplete Fields” setting) which will cut down on the number of terms loaded into the autosuggest. Second, if your database is realy, really large, you may need to turn autocomplete off altogether.
If you are concerned with database performance issues, it’s a good idea to tune your server for better performance. You may want to ask your web hosting provider about that, it is a fairly technical subject and requires server configurations you may not have access to.
Hi Roland,
Is there a way to tell what search keywords are input the most, hit and missed the most in a certain period of time? If not for now, is this part of your roadmap?
Regards,
I’ve thought about this and although I think it’s a good idea, I don’t have specific plans to imlement something like this currently.
Hi
I have trouble showing rows when searching for words with the norwegian letters æ, ø and å in Multi Search. In Combination Search it works fine. The tables are set in utf8_unicode_ci.
Any ideas?
This is working in my tests here. I’m using the same collation in my db. Have you tried turning plugin debugging on, then check the debugging log to see what the query for your search is?
I did so now and I see that it doesn’t search for the letters .æ, ø and å:
[06/04/20 8:46am UTC]
PDb_List::_setup_iteration list query: SELECT p.id, p.eierens_navn, p.fornavn, p.etternavn, p.fodselsdato, p.vis_detaljer FROM wplo_participants_database p WHERE p.kilde = “Bilboka 1922” ORDER BY p.date_updated DESC
[06/04/20 8:46am UTC]
PDb_List::_setup_iteration list query: SELECT p.id, p.eierens_navn, p.fornavn, p.etternavn, p.fodselsdato, p.vis_detaljer FROM wplo_participants_database p WHERE p.kilde = “Bilboka 1922” AND p.eierens_navn REGEXP “[[::]]” ORDER BY p.date_updated DESC
[06/04/20 8:47am UTC]
PDb_List::_setup_iteration list query: SELECT p.id, p.eierens_navn, p.fornavn, p.etternavn, p.fodselsdato, p.vis_detaljer FROM wplo_participants_database p WHERE p.kilde = “Bilboka 1922” ORDER BY p.date_updated DESC
[06/04/20 8:47am UTC]
PDb_List::_setup_iteration list query: SELECT p.id, p.eierens_navn, p.fornavn, p.etternavn, p.fodselsdato, p.vis_detaljer FROM wplo_participants_database p WHERE p.kilde = “Bilboka 1922” AND p.registrert_i REGEXP “[[::]]” ORDER BY p.date_updated DESC
[06/04/20 8:47am UTC]
PDb_List::_setup_iteration list query: SELECT p.id, p.eierens_navn, p.fornavn, p.etternavn, p.fodselsdato, p.vis_detaljer FROM wplo_participants_database p WHERE p.kilde = “Bilboka 1922” AND p.registrert_i REGEXP “[[::]]” ORDER BY p.date_updated DESC
OK, I have to check into that…you’re using “Whole Word Match Only” and that seems to be incompatible. I didn’t know that was a problem. You may want to turn whole word match off. Thanks for the report, I’ll fix it soon.
Thanks for the tip. I turned of “Whole Word Match Only” and now it works fine :-)
Hi Roland,
I have recently started using your combo multi-search plugin, and it’s really done
the job for me! If you have time, please could advise me on the following?
Once the user has submitted a query, I would like to access some
of the search values they submitted so I can pass them to a function I wish to write. How can this be done?
I’ve done a little bit of coding, and keen to learn more but I am generally new to the world of WP, and would be grateful if you could point me in the right direction so I can take it from there.
Many thanks,
James
The best way to do something like this is to use the pdb-list_query_object action to get access to all the search filters that were used for a particular query. Take a look at the PDb_List_Query page to get some ideas how to work with that object in your action handler.
This is a general-purpose action, so you will want to check the PDb_List_Query object that is getting passed in to see if the query is one you are interested in. This action is also used by Combo Multisearch to add its filters, so you will want to put the priority of your action handler to a high number so that you’re getting the object after all other code has had a chance to alter it.
Thanks Roland, much appreciated. Your advice has indeed got me started!
Best, James
Just installed the multi-search-plugin.
It works fine in frontend. Is it possible to enable it in backend or did I miss something ?
Combo Multisearch is front-end functionality only. On the admin side, there is a multi-part modular search you can use to filter the list of records. Take a look athis page for the details: Admin List Participants Page
So the admins has to do it the hard way :-)
Thanks for the reply.
BTW: Just installed your participants DB plugin on my new real site and it works great, exactly what I needed.
Hi Roland, I am enjoying your plugin. It looks as though the search/list allows for only one combosearch entry with multisearch. I would like to do three in one search form if possible. As this site may become very large, it would be good to select down the records successively immediately by selecting State, City, Street before using the autocomplete combosearch to find the one record that is desired. Is this already feasible or do you have any plans in that direction? The fundamental problem is that most people always enter too much information and misspell names ending up finding nothing. If they only entered the first one or two letters in all the fields, they would do far better. That also gives an opportunity to do that in the template for them. Thanks, Fergus
Fergus, you can do something like this if you use the Chosen Selector add-on and set the form element of those fields to be a chosen selector…then in the multisearch, the chosen field will do an autosuggest on those fields. You must have the latest version of Combo Multisearch and Chosen Selector for this to work.
Hi Roland, Perhaps I am missing something, so I should give a concrete example.
I have a friend with the first name “William” but his nickname is “Pete”. I have a field for the true first name and another for nicknames. Combosearch does a nice job of searching both and autosuggesting from both fields simultaneously.
Since many people would not know that “Pete” is his nickname, they would be unlikely to find him if they searched in the first name field under “Pete”.
Women have a habit of changing their last names, so I have one field for their current last name and another for their maiden name. It would be good to do this the same way as for the first name/ nickname with autosuggest.
The same is true for the middle name and maiden name.
If all this could be preceded by narrowing down the search by selecting with City, state, street, by the time you got to the names, the autosuggest could be quite fast.
I can easily find people with the existing search tools, but even the least savvy person could find people with ease if it were possible to do the combosearch on three pairs of fields.
I knew a girl in the 6th grade. Her last name was Dickenson. She was a very cute blonde and very sweet. You can be certain that she got married and changed her name. I’m not carrying any sort of torch for her, but if I were, and if I didn’t know how to search well, I would never find her.
I understand what you’re trying to achieve, and it sounds like a good idea, but the plugin can’t generate multiple combo search fields. Have you tried just putting all the searchable fields into the combo search to see how that will work?
That’s ok. I can do it another way. It just would have been very simple and intuitive for people. I have found that 95% of people cannot do a simple search. All they can do is type.
I have found a couple of very minor issues.
The .csv import function does not show all the fields in the database and refuses to import the .csv even though the fields are actually in the table. Perhaps this is due to placing the fields in the combosearch.
I also notice that after I delete a field, although it is gone from the interface, it is still in the database when I look at it directly with SequelPro. I can remove it with SequelPro and it doesn’t seem to affect anything, but perhaps you are leaving the fields in intentionally, just not using them.
I am enjoying the Log tables. One minor thing is that when I add 8-10 fields, the order of the fields on the “Manage Log Fields Screen” can suddenly invert. I can drag them back into the order I want and it doesn’t seem to affect anything.
I removed all the multisearch and combosearch fields and reconfigured the fields. The .csv field list straightened out and I was able to upload the .csv file without a problem.
I notice that the “chosen” dropdown fields apparently are using a separate cache to retain the database dropdown list. When I add an entry manually, it updates the list, but it doesn’t update when you add records by .csv.
When I deactivated the “chosen” plugin, deleted the database fields from the multisearch field list, and reinstalled them, the “chosen” plugin recognized all the field entries from scratch.
Thanks for letting me know, I’ll check into that.
As I think about it, it might be a good idea to not force the addition of a new field entry into the lookup every time a new record is added. It might put a huge burden on the system if it had to regenerate the list from scratch every time.
All that would happen is that the cache would be marked as stale, then get regenerated next time it was needed. That only happens once, not on every record, and also not when importing, it happens the next time the search page is loaded.
If you had a million records and users frequently changing their records that sounds like the cache would always be stale.
You’re right, and that is one of the limitations of off-the-shelf plugins, they are not going to be optimized for specific cases like that.
Hello. I am using Combo Multi-Search and Datepicker add-ons. I would like to include a date field as one of the multi-search options. Can an end-user select a range of dates in which to search?
Yes, check the Combo Multisearch settings under the Multisearch Fields tab. Add your date field, then under “input type” select “date range.”
That was easy. Thanks!
Hi Roland, I hope to use this plugin on a new project but checking if this is possible. I need to determine which multi search fields are shown and via a remote search. In other words, I want to use eg
[pdb_search template=multisearch search_fields="field1, field2" target_page=listings]. I got the target_page to work, but all the mutisearch fields are displayed rather than the specified ones .
I used the same search_fields options with the shortcode for pdb_list templete=multiserach and it works perfectly. If it’s not possible via pdb_search then I’ll have to think of another way to achieve this, but if it can, I will happily purchase a second license (I’m using the plugin purchased for another earlier project, for testing only).
The main reason I need to use pdb_search and not one of your pdb_list templates, is because I have developed a custom template to display all data of the selected participants via a accordion dropdown (as at https://edmundjolliffe.com/2020/test-catalogue/).
Thanks for your help and amazing plugin.
Thanks to your post, I’m learning that the “search_fields” attribute in the search shortcode isn’t working as expected. It looks like it just shows the globally-configured multisearch fields. I will need to issue an update to fix this, sorry.
Specifying search_fields does work with the pdb_list template=multisearch by the way, perfect, amazing! Means you can have different stylish search options for different selections of the data. It’s so cleaver. Good luck with the fix and thanks again for your support.
Hi Roland,
No problem at all for a long time, and some users reported that my settings should not be set correctly. By the way, I upgraded to the last version of the multisearch plugin, looked into the settings, looked at my shortcode, and I don’t understand what’s wrong.
Here is the link to the page where I placed this shortcode: [pdb_list template=multisearch list_limit=-1 sort=true] : https://www.thermatht.fr/bdd-liste-enregistrements/ (sorry, it’s in french…).
Whatever I select, no match. Clearing the form, the list disappears. I’ll try to look again into the settings…
You can try also a classical pdb_list without multisearch here: https://www.thermatht.fr/bdd-recherche/
Best regards,
OR
The reason your searches are not working is php sessions are not working. You can see this in the Developer Tools network panel in the response to the AJAX request. You may see some evidence of the problem in your php error log. This can be because of server configuration, or maybe cookies are not working. It could also be because of a conflict with another plugin or the theme. That would show up in the php error log.
You can try using the “Use Alternate Session Method” setting to see if that helps.
Ok, you’re right, nothing returned from the AJAX request. The fact is that I use sessions and cookies on this website. Do you know if there is a way to identify the name of the cookie used for sessions with pdb and multisearch (that should be the same…).
I tried to use the alternate session method of course. It does not have any effect. I’m not sure to have access to the php error log, but I will ask (I’m not on a dedicated server, nor VPS…)
Best,
OR
Probably what is happening is some other plugin is configuring the use of sessions that is incompatible with Participants Database. The php error log will provide the specifics, and possibly suggest a workaround.
Roland, I’ve also noticed that the error message for any incorrect search combination doesn’t display properly any longer? It shows like a red box but the error text message is like blank/missing.
Thanks for the report, I will investigate.
I’m getting users complaining the multi-search stopped working where their searches are futile and keep showing up blank (nothing appears in search results).
They try to search either Cities or Country and search results are still blank.
I have tested it and can confirm our users are right because I am getting the same behaviour!
It only seems to work okay on the latest chrome:
Google Chrome is up to date:
Version 81.0.4044.138 (Official Build) (64-bit)
My laptop is this version which doesn’t work:
Version 80.0.3987.163 (Official Build) (64-bit)
Any idea why because it renders our search database completely useless!!
I am not aware of any incompatibilities with previous versions of Chrome, but if you could report the errors you are seeing in the console when it does not work, that would be helpful. I don’t see these problems here. If you can send me a link, I can test it myself.
Meanwhile, make sure you are not using page caching on the page, also be sure to clear any server caching you are using to make sure the latest version of the code is getting used.
Ah! It’s my server caching! I completely forgot about that. After years of updates, the setting made years ago seem to have cleared itself! Thanks for pointing that out Roland. I can confirm this works now :)