• Resolved stoelwinder

    (@stoelwinder)


    Please accept my apologies in advance for anything stupid I may be doing or not doing. And also for the wall of text that you’re about to see that explains my situation a bit better.

    I have been running Relevanssi for the past few years and really like the search results it generates. With 1000’s of products, it can become difficult to find the ones you’re looking for and Relevanssi does the job (behind the scenes).

    I have restricted Relevanssi to only search through products and not through pages. However, recently I was thinking of adding links to specific search results that point to specific “Collection pages”. So, I enabled Pages in the settings and saved.

    Example:
    If I had a page that listed all Mario related products and someone types “Mario” as their search result, I would want it to show a “banner” at the top that points to the Mario collection page. Below that, it should have all the standard search results.

    Now, I am struggling with this, because somehow I’m not able to make it detect the pages and I’m not able to customise the results in one way or another.

    1. When I now search for Mario (or another keyword that is in a specific page), it only shows me the products. Pages is checked, so that means it should detect them, correct? I tried this with several search terms, all only resulted with products.
    2. At some point I was wondering whether Relevanssi is actually working. Yes, its activated but when I deactivated and deleted it, the results still looked the same. So, I reinstalled Relevansi, searched and got no results. Then rebuilt the index and I get the results again, which makes me believe relevanssi is working properly.
    3. I can’t seem to customise the look of the Search results page. I use Sistina as my theme, but when I try to change the Search Results page (under Pages) or change the sidebar layout in Sistina, the page doesn’t change when I search.

    Anyway, appreciate your help in 1) trying to figure out whats going on and 2) trying to find a solution to getting a link to a specific page show up as the first result (preferably formatted in a certain way that distinguishes itself from the products) in my search results.

    • This topic was modified 7 years, 7 months ago by stoelwinder.

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter stoelwinder

    (@stoelwinder)

    Sorry, to add on: at first, I didnt have pages checked. When I wanted to get the pages to show up in the results, I checked pages and saved the settings.

    Plugin Author Mikko Saari

    (@msaari)

    As for 1), your search is being restricted to just products. As you can see: https://www.gameshome.com.sg/?s=mario&post_type=product has the post_type=product in it.

    If you remove that, you should see other post types in the results as well: https://www.gameshome.com.sg/?s=mario No pages show up, as can be seen from here: https://www.gameshome.com.sg/?s=mario&post_type=page Have you rebuilt the index after changing the indexing settings?

    However, the product layout in the search results is bound to the post type parameter, so that disappears as well. That search results page you get without the product layout is probably one you can change.

    So, you’d need to make sure you’ve rebuilt the index, then work on your theme so that you get the desired search page layout without the post_type parameter, then sort the results by post type (see instructions here), then fix the search results template so that pages (that should be moved first in the results) are printed out the way you want.

    It’s a bit of work, but definitely possible to achieve.

    Thread Starter stoelwinder

    (@stoelwinder)

    Dear Mikko,

    Thank you so much for taking the time to look into my issue and giving me suggestions on how I can resolve the problem I’m having.

    Unfortunately, I’m still running into a bunch of issues.

    – Mario was just an example. If I go to https://www.gameshome.com.sg/?s=thrustmaster&post_type=page for example, it does give me the results for 2 pages, but the challenge here is that I only want 1 result to show up, not 2. I want to customise what people see when they search for a small subset of keywords, by presenting a “page banner” at the top that brings them to all products of that type.

    – More importantly, I’m facing challenges with customising the search results page. I can’t seem to get it to show up anything I change:
    1. In my Sistina (my current theme) settings, I go to Theme Options, then Pages and Search and change the words for what it shows as a search result. Nothing changes after saving.
    2. In my WordPress Pages, I go to the Search page and see [woocommerce_search]. I add Blah Blah and save, yet nothing changes to the resulting page. I try to change the layout a bit (like move the sidebar to the left) and again nothing changes.
    3. In Appearance -> Widgets, I see 3 search widgets. Currently the one that I’m using is Woocommerce Product Search Widget (which was the one that came default with Woocommerce installation), which may explain why it adds the post_type to the URL. So, I change it to Search or Mini Search. When I search for something then, nothing shows up. It just tells me that no matter what I search for, nothing is found.

    The URL changes to: https://www.gameshome.com.sg/?s=mario&post_type%5B%5D=post

    And the text shows: Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.

    No matter what I change, nothing seems to be happening and I’m at a loss. What am I doing wrong? Is my theme driving me nuts, is it the fact that Relevanssi is not even called properly from the “Woocommerce Product Search” widget? I can’t figure out why nothing changes when I update things on the search side.

    Thanks again for your help and hopefully you have some suggestions on where else I can look.

    Plugin Author Mikko Saari

    (@msaari)

    The search page is usually edited from your theme template files and not from the WordPress admin dashboard: it’s the file search.php in your theme folder. Does editing that file change how the search results look?

    If your theme is driving you crazy, changing to a more standards-compliant theme might not be a bad idea.

    Thread Starter stoelwinder

    (@stoelwinder)

    Dear Mikko,

    Unfortunately it did not change anything either. There’s no search.php. There was a searchform.php but changing that, changed nothing to the search results page. I eventually was able to “hack” things a little bit. I found the breadcrumbs file that printed something on screen, that I was able to customise to check the search term and then update the printing accordingly.

    Not neat, but it does the trick. As for changing the Theme, I agree but unfortunately things are not that simple. One day I may go through that trouble, but for the time I’m stuck with this.

    Thanks again for the suggestions. Based on what you advised, I was able to find a solution/work-around that at least resolves the issue for me. Hopefully others will have more success with their setup ??

    Regards!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Customising Search Results’ is closed to new replies.