Product Support

Combo Multi-Search

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.

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.

shows how to interact with the multisearch fields interface
Configuring the Multi Search Fields

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.

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.

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.

Support Discussions for Combo Multisearch

  • Hi. Great plugin by the way. Got the Combo plugin, trying to build a search where several fields can be selected and only the records with those exact matches are displayed.

    General Settings Tab – Filter Mode – Enabled.
    Combination Search Settings Tab – Default Search Modifier – All
    Multi Search Settings Tab – Multselect

    I seem to getting all the records with any of the fields selected. What else do I need to check?

    • The best way to interpret the results and help configure the search is to turn plugin debugging on (in the main plugin under the advanced tab) and then perform a search, the db query that is used will be in the log and you can see whether it’s giving you the query you want.

      I suggest you do not try to combine combo search with multi search, from your description, you should use multi search only. Clear out any fields you have in the “Combo Search Fields” setting, and put all the fields you need into the multisearch fields configuration.

      • Hi Roland. Thanks for the response. Did that and it is working now … appreciate that. 100 years ago (1980’s) I was a top programmer but my brain is a bit old now …. hehe.
        Anyway, one more thing, I get the results I want but the search “hangs”, I have to refresh the browser and only then the results appear?

        • The page hanging indicates there is an error in the javascript. If you provide me with a link to the page, I’ll take a look.

  • Please, the shortcode: [pdb_list template=multisearch search_fields='combo_search'] does not show any search box. Any idea what might be the reason?

    • You must define which fields are included in the combo search. This is in the Combo Multi Search settings under the Combination Search tab, the “Combination Search Fields” setting.

  • The date range search for the combo plugin works great. Thank you so much for updating it.

    • It seems the date range is broken again – with 2.31 update. When I enter 08/31/2020 – 09/1/2020. I don’t get 09/1/2020 records. I have to enter 08/31/2020 – 09/2/2020 to get both 08/31 and 09/1 records. To get 9/1 records, I have to search 9/1 – 9/2. Looks it reverted back to the old way before update 2.3

      • Thanks, it looks like the second term of the range is set to the beginning of the day, should be the end of the day to include the whole day. I’ll issue an update to fix this soon.

  • Are there any known issues with the date range queries? I have a last_updated field, and a combo multi-search option to search for a date range. I’ll use 08/12/2020 as an example. If I put 08/12/2020 in the 1st box and nothing in the second box I get all the records: (Date Debug Log below)

    … p.last_updated >= CAST(1596258000 AS SIGNED) AND p.last_updated = CAST(1597208400 AS SIGNED) AND p.last_updated = CAST(1597208400 AS SIGNED) AND p.last_updated <= CAST(1597294800 AS SIGNED) …

    Is this all expected behavior?

    • Sorry, I just realized I lost a bunch of the debug and it got truncated. The 3 areas I tried are:
      08/12/2020 in 1st box and 2nd box blank – all records
      08/12/2020 in 1st and 2nd box – 0 records
      08/12/2020 in 1st and 08/13/2020 in 2nd gives only 08/12/2020 records

      CAST() binaries were inconsistent also in the above queries. Wondered if this is expected?

    • The bit of the log you posted does not look like it matches the search you mention in your question. Be sure to clear the log before testing so you can be sure you’re looking only at the query for the test you just performed. The query you posted would be unlikely to return any results, I’m not sure what configuration leads to a query like that.

      When using a ranged input for dates, both inputs must be filled in to get the range of dates. You can enforce this by adding “required” to the field attributes for the date range field.

      When searching within a range of dates, it sometimes happens that a date in the record that is the same day as one of the range values will not be included in the result because of a time difference. Timestamps are to the second, and the query is simply doing a numeric range search. You can check the UNIX timestamp by visiting a site that performs timestamp conversions, that will help you understand why you’re getting a specific result.

      • Thanks. Sorry about the debug logs. I was clearing and refreshing each time, but posting here was messing the logs up – I think because of the less-than symbols.

        The date range you are talking about makes sense if it includes time as well. What is the time assumption in the UNIX timestamp conversion when the input is only a m/d/y? I can do some tests with the UNIX timestamp site.

        Is there a way for me to modify the CAST, and have it use only the date portion and skip the time stamp? Assume I’d have to modify some .php template somewhere.

        What I really want to do is enter 08/12/2020 in both boxes and have it return all the entries for that day. I originally thought maybe I could only enter the date in one box and leave the second one blank, but I see now why I can’t do that.

        • I’ve never been fully satisfied with how the search function handles dates even though I’ve spent a lot of time on this very thing.

          A UNIX timestamp is the number of seconds since the beginning of the UNIX epoch, so there is no such thing as a date without a time in that scheme. Best you can do is search for a range within a 24-hour period, but even that can give unexpected results because of timezones. It’s one of those things that seems like it should be simple, but it really is not in practice.

          Some of what is happening has to do with the time that is saved with the dates in your data. In Participants Database, when a date is saved, the time is set to 12AM, with the timezone determined by either the WordPress timezone or the server timezone (depends on the server configuration…this is out of the control of the plugin, although I do try to enforce the WP timezone). If the stored date and the query are both in the same timezone, it works OK…but that is not always the case.

          If you want to get all the entries for a single day, you need to use a ranged search such as 08/12/2020 and 08/13/2020. This is because the time will default to 12AM….but whether this works well with your data or not depends on the time and timezone that was used when the data in the record was saved.

          Anyway, this got me to thinking I should take a closer look at how this works and try to improve it.

        • I just released an update to Combo Multisearch that I think improves the handling of date searches, including support for partial date inputs. Take a look at the documentation for details:

          Searching on Date Fields

  • Hi Roland,
    We have an issue with the combo search: we have 5 search fields, and we’d like user to input all five search fields to get the result, so we choose Result level 1 – Global Filter Mode ON & Search Modifier ALL in the settings. However the search does not return any result. When we chose Result level 2 – Global Filter Mode OFF & Search Modifier ALL, if the user input all 5 fields, he did get the result back. However if the user’s input is partial, e.g. only 1 or 2 fields provided in the search box, the search still returns result, which we would not like to happen as it caused some restricted info being shown up in the result. Is there a way to force the user to put in all 5 required values before they can get the search result?

    Thanks,
    John

    • So, for your first question, the best way to understand the results you are getting is to turn plugin debugging on (this is in th emain plugin under the advanced tab) then when a search is performed, you’ll see the query in the log. That will tell you why your not getting any results.

      The is a setting for the multisearch “Require all Search Fields” you can use to force the user to fill in all the search fields.

      • Thanks Roland,

        From the debug log I can see the “Result level 1 – Global Filter Mode ON & Search Modifier ALL” setting is not really what we want, and I wonder if it is really usable for anyone. For example, if I want to search on city and country fields, and I put in “Milan Italy” in the combo search text box, it won’t get me the result as the query is like this “… where city=Milan and country=Milan and city=Italy and country=Italy”, which is why no result can come out. Should the query be “where city=Milan and country=Italy”?

        The “Require all Search Fields” works for multi search but not combo search. Is it possible to make it work for the combo search?

        • Do you find you are unable to set a search mode that works for your situation?

          It often does not work well to try to combine combo search and multi search, so I would suggest you use one or the other. It can be confusing to users because they don’t know what to expect when you’ve got a UI that combines a general search with a specific field search.

          If you are using combo search, and you want to force the user type in a search, you would pair that with the “suppress” attribute in the shortcode so that no results will be shown unless a search is performed.

  • Where can I translate the text on the “Search” and “Clear” buttons in Combo Search? Thanks.

    • This is in the language files, you will need to generate a language file for the language you’re using on your site.

      Localizing Participants Database

      A less flexible way to do this is by using a custom template, the template gets those words from the language files, but you can put your translated words inot the template directly if you only need a single language.

  • At some point in the past few months the multisearch on our site stopped working. There’s no error message, just nothing when a search is attempted. We’re using this shortcode: pdb_list template=multisearch-cust. I’ve also tried pdb_list template=multisearch. Previously it worked perfectly.

    The debugging log has this: PDb_List::_setup_iteration list query: SELECT p.id, p.website, p.country, p.city, p.curriculum, p.accreditation, p.religious_affiliation FROM wp_participants_database p ORDER BY p.city DESC

    Any help is appreciated. Thanks.

    • Probably a problem with the javascript or perhaps your php sessions are not working. This can happen if new plugins are installed that interfere with the javascript or perhaps the configuration of your server changed.

      Can you send me a link to the page so I can see what’s going on?

      send it to support@xnau.com if you need it private.

  • Hi Roland,
    Just a quick question: Can the plugin be used in the background (dashboard)?
    Thanks

    • If you’re asking if the Participants Database plugin can be used as an admin-only plugin, the answer is yes. All the functionality of the plugin is accessible in the admin section, no need to expose it to the frontend at all.

      Although, since you’re asking on this page, Combo Multisearch is frontend only.

  • Im trying to use the shortcode [pdb_list template=multisearch search_fields='combo_search'] but it returns both the combo AND the mutlisearch fields?

    • That should work, I just checked it…are you using the latest version of Combo Multisearch?

  • Hi Roland,

    I noticed that if the Last Name/Maiden Name are used in the combo/multisearch shortcode and the Last Name field is not filled out in the record, and you search only under First Name, the search results substitute “localhost:8888/TestSite/single/?pdb=1453” in the Last Name column instead of being blank. When you click on the search record to see the detail it comes up with the correct detail as it should with the Last Name blank.

    Here is the shortcode: [pdb_list template=multisearch suppress=true]

    I also notice that the “chosen multi dropdown/other” does not let me enter any “other” name. It tells me that it wasn’t found. I was expecting it to accept the entry.

    • Thanks for pointing this out…when a field that is designated as the “single record link field” is shown in the list display, it is supposed to have the link to the single record page. If the value in the field is blank, it just shows the link itself. This may not be ideal, but the “single record link field” setting isn’t compatible with a column that could have blank values. If your system allows blank last names, it may not be the best choice for your single record link field because this will happen whenever a record with a blank field is displayed in a list. The reason it does this is because it is assumed that the link to the single record is important enough to be accssible in every case.

      The Chosen “other” controls don’t allow for a type-in entry. You can use the “Database Values in Selector” setting on the field if you want all the “other” values to be available to the search.

      • I understand. I can easily require that the user enter the last name if it is used in the combo search terms.

        Regarding the Chosen Dropdown Multi /Other Menu, I was expecting it to allow for entry of an “Other” value when creating a new record. I tried eliminating the option to save the value as something else, but that didn’t help.

        So I understand, you are saying that when SEARCHING “Other” would not be available as a choice? Otherwise, I am not sure how one would get additional values into the field.

        • Now that I look at it I see that I made a mistake to upgrade the “chosen” js to a version that does not support the “other” type fields. I will need to issue an update that will fix this.

Got a Support Question?

Your email address will not be published. Required fields are marked *

Would you like to be notified of followup comments via e-mail? You can also subscribe without commenting.