Advanced Search Form Scrambling Fields when there are multiple rows

I’ve recently noticed that the advanced items search form on my site no longer works if you search on more than one field. Specifically, if you search for two things, like Date = 2011 AND Title contains ‘asia’, the query that’s actually run is Date contains ‘asia’. Was there a recent change to the search form logic? I do have a slightly modified search form template in my theme (here: archaeobib/items/search-form.php at master · sashafr/archaeobib · GitHub), but that has been working fine for the last several years until recently (altho its only recently been reported to me, it might have been an issue for a couple months and my clients just passed it along, they don’t check in on this site super often).

Here is a specific example:

URL of the search results page:

https://pennds.org/archaeobib/items/browse?search=&advanced[0][joiner]=and&advanced[0][element_id]=40&advanced[0][type]=contains&advanced[0][terms]=2011&advanced[0][joiner]=and&advanced[0][element_id]=50&advanced[0][type]=contains&advanced[1][terms]=asia&type=&tags=&range=&collection=&user=&public=&featured=&submit_search=Search+for+items

The actual query if I turn on debug.profileDB:

SELECT items.* FROM om_items AS items LEFT JOIN om_element_texts AS _advanced_0 ON _advanced_0.record_id = items.id AND _advanced_0.record_type = ‘Item’ AND _advanced_0.element_id = 50 WHERE (_advanced_0.text LIKE ‘%2011%’) GROUP BY items.id ORDER BY items.added DESC, items.id DESC LIMIT 30

Any advice on where to look next would be great!

Can you try the change shown here?

That is, add

if (!oldAttribute) {
    return;
}

to the file application/views/scripts/javascripts/items-search.js immediately after the line

var oldAttribute = element.attr(attribute);

(Note: you’ll likely need to “hard refresh” or clear your browser’s cache to see the effect of that change.)

I had the same issue in the fall- their response about replacing a javascript file fixed it (link is in their comments on the thread here): Advanced Search with multiple fields searches value in wrong field