I’m trying to make different search-form.phtml files in my theme/view/common/block-layout directory to allow for more specific searches on individual pages.
Below is my search-form code, mostly taken from my theme with the added “hidden” input type below. Currently, if I add a normal advanced query ("?fulltext_search=&property…"), it will change the resulting URL but will not change the advanced search parameters at all. Instead of seeing one author’s “letters” for example, the user sees every author’s letters.
Is there some other section I should be changing? I just want to add two hidden parameters with an OR function to whatever the user types into the search box.
The problem here, I think, is just the name of your hidden input. author isn’t a key that has any significance to the search, so adding it in a hidden input won’t have any effect (unless you have a module or something that does use that key, but since you didn’t mention anything like that, I assume that’s not what’s happening).
The simplest thing to do is use the advanced search to compose a query that limits the search in the way you’re looking for, then that URL will contain the keys and values that you’d need to use to have the same effect as hidden inputs.
Reading more closely, it looks like you’re already doing the “do an advanced search and use that URL” part, but you tried to include that whole query in a single hidden input? Is that right?
If so, the advice is still the same but the specific misunderstanding you’re running into is just on how hidden inputs work: each is just one “entry” in the query string, one something=something pair. So you need a separate hidden input for each piece of your query that you want to apply. Taking a random example of an advanced search for a single value of a single property, the relevant part of the query is:
If I’m understanding you correctly and you want to do this with a value query with two “rows,” you’d be looking at 8 hidden inputs (you could get away with 7, the “joiner” for the first entry isn’t actually necessary, but still).