Search cross-filter conditions for custom event search widget

Hi,
I’m setting up a past events search page for one of our departments, and I was able to add a search option that works and looks through all parts of an event widget for the search term. However, I can’t seem to make it do anything but a single term/phrase search. The + condition for it to search for two separate terms that might exist within an event does not seem to work. For example, searching for Antitrust returns all events that have it in the title/summary/description (including ones from 2024), or searching for 2024 returns all events from 2024 (including Antitrust titled events), but Antitrust + 2024 (or Antitrust +2024) does not return anything.

I followed the basic setup from our main search page and am using the following as my search conditions/filters in that event widget:

<arg id="filter_mode">any</arg>
<arg id="filter" name="title" action="matches"><xphp var="search" type="GET"/></arg>
<arg id="filter" name="summary" action="matches"><xphp var="search" type="GET"/></arg>
<arg id="filter" name="description" action="matches"><xphp var="search" type="GET"/></arg>
<arg id="filter" name="date_dt" action="matches"><xphp var="search" type="GET"/></arg>

This works fine for single terms/phrases/years, but as soon as I want to search for a keyword term (in any of the filtered fields) + year, it does not work. Is there another way to set up my search filters/conditions? I am using the + and - options to search/subtract in my search tests the way it’s stated on the search doc page, but should I be using something else instead?

After I typed all this out, I realized one of the suggested tickets from September 2024 that popped up seems to be not exactly the same but similar to what I’m trying to do (Widget filter_mode). Is it actually still the same thing, and therefore not doable in a custom widget search yet for multiple filter terms i.e. looking into two separate filters at the same time? If so, are there any other suggestions for cross-filtering/going more granular with disparate non-sequential terms in a search setup? Any help is appreciated, thank you!

Hi Sudeshna,

Hmm – for searching events using an events widget, I wonder if what you want is something like a hard-coded date dropdown? If you did something like

<label for="search_input">Keyword(s):</label>
<input id="search_input" type="text" name="search_input" placeholder="Search">
<label for="search_year">Year:</label>
<select name="search_year" id="search_year">
  <option value="">All Dates</option>
  <option value="2026">2026</option>
  <option value="2025">2025</option>
  <option value="2024">2024</option>
  <option value="2023">2023</option>
  <option value="2022">2022</option>
  <option value="2021">2021</option>
  <option value="2020">2020</option>
  <option value="2019">2019</option>
  <option value="2018">2018</option>
  <option value="2017">2017</option>
</select>

It would allow you in your widget results page to separate the keyword search (whether you prefer the “search” argument or the more targeted “filter”) from the date range selection:

<widget type="events">

    <xphp content="true">
        <if var="search_input" type="GET"/>
        <content>
            <arg id="search"><xphp var="search_input" type="GET" /></arg>
        </content>
    </xphp>

    <xphp content="true">
        <if var="search_year" type="GET"/>
        <content>
            <!-- LW: Show events from specified year -->
            <arg id="start_date">01/01/<xphp var="search_year" type="GET" /></arg>
            <arg id="end_date">12/31/<xphp var="search_year" type="GET" /></arg>
        </content>
        <else content="true">
            <content>
                <!-- LW: Show all past events -->
                <arg id="start_date">-15 years</arg>
                <arg id="start_date">today</arg>
            </content>
        </else>
    </xphp>

</widget>

See if something like this helps? Let us know if we can say more about this, thanks.
More on search widget setup

1 Like

Thanks, Karl! Funnily enough, I had a fully separate dropdown already, but I didn’t think about a combined dropdown for year sorting within a search. This is very interesting and I’ll try it out.