• Resolved bcimedia

    (@bcimedia)


    I have a search form with two dropdowns, Locations and Categories. If I leave the search form blank, and just choose from either Locations and/or Categories, I get no results (and, oddly, no message saying “no results found”). I just get a blank page. If I put in a search term, I always get results (unless I type gibberish, and even then, I never get a “no results found” message, but I guess that’s a different ticket), and they filter successfully using Location and/or Category. I have been going around and around with this for days but I can’t find a reason for it. Otherwise the plugins works perfectly. I do need users to be able to search our listings by location and/or category, without necessarily entering a search keyword. Any suggestions? Is this even possible?

    • This topic was modified 1 year, 3 months ago by bcimedia.

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Mikko Saari

    (@msaari)

    A blank page generally means an error has happened. Can you access the server PHP error logs? There might be a helpful error message there.

    This is possible: when no search term is entered, Relevanssi returns all posts on your site (and if you have taxonomy filters, those filters are of course applied).

    Thread Starter bcimedia

    (@bcimedia)

    Apparently this combination produces no error. When we enter no search term, but also no dropdown filters, we get all the directory listings – which is expected behavior. It’s only when we have no search key, but include a filter from the dropdown, that we get nothing at all. No message, just the blank page with “Search results for: “

    then the result….

    It makes no sense to me. I would think it would – in this screenshot – show all listings from Colorado. But… nothing.

    Plugin Author Mikko Saari

    (@msaari)

    Ah, so it’s not a blank page, but a page with headers and footers and other page structure. That’s less of a sign of an error than an actual blank, white page.

    Hard to say; it’s Elementor, so I don’t know what’s happening on that search results page. I can’t really help debugging Elementor issues. Does this work in the Relevanssi admin search (Dashboard > Admin search, not the generic WP admin search)? If you set no search term, but copy and paste the query parameters from the search results page URL to the “search parameters” box, do you get the correct results?

    Thread Starter bcimedia

    (@bcimedia)

    I have done the search in Admin using Relevanssi and it works great.

    So I took the url after doing a search just using a location category, and then put it in the search box. I got results! Although, they’re not accurate. Which is weird. But it’s a win that I got results!

    I will make a non-Elementor search page and see what I get. I’ll let you know. Thank you for working this out with me!

    Thread Starter bcimedia

    (@bcimedia)

    Ok. so it’s something to do with my custom search template. I tested it without using the custom template and the dropdowns work fine. I apologize for wasting your time with this. Thank you for the brainstorming!

    Thread Starter bcimedia

    (@bcimedia)

    closing

    Thread Starter bcimedia

    (@bcimedia)

    Hey so I figured it out. I want to share what I learned so if anyone asks you about this again, you’ll have an answer for them. I had created a custom template for search results with Elementor, and I used the loop grid widget for the results so I could have a custom skin on my search page. This set up requires a keyword in your search form in order for the dropdown filters to work properly. Since I wanted to be able to use the dropdowns without a keyword, I needed to find a way around this.

    I tested and learned that keying a space in the search form allowed the dropdown filters to work. The space fulfilled the necessary requirement for something in the form, which allowed the dropdowns to work correctly.

    So, I added s=” ” to the searchform shortcode as a parameter. The “s” defines the default search query. And that’s all that was needed. The front end doesn’t look any different, but when users only select from the dropdowns without any keyword, the search now works perfectly.

    However, I just realized this solution has broken the actual keyword search, so I’m back to the drawing board. When I enter in a search term, it doesn’t actually look for it. ARGH

    • This reply was modified 1 year, 3 months ago by bcimedia.
    Plugin Author Mikko Saari

    (@msaari)

    Yeah, you can’t have two s parameters in the same form, that’s not going to work as expected. What you need is a filter (maybe on pre_get_posts action) that sets the s to ” ” if it’s empty and the dropdown parameters are set.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘dropdown search produces no results’ is closed to new replies.