Override search results page

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Override search results page

This topic contains 40 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 8 years, 1 month ago.

Viewing 15 posts - 1 through 15 (of 41 total)
  • Author
    Posts
  • #6671
    optimalpartners
    optimalpartners
    Participant

    Hi, I’m having an issue where the override for the search page is not returning any results. There are results in the drop down live preview for the same search term, and if I select to not override the page, I get the same results as the normal search. I saw a few other responses that had this same issue, but I could not find how to fix it. If possible, I’d ideally like to have the results displayed similar to the drop down live preview so that they are grouped by type.

    Also, I noticed that the search icon on the right of the search bar is displaying on top of my drop down menu when I hover to make it drop down. I’ve had issues with other plugins doing that so I think it has something to do with the Z index, but I’d need to know how to fix it for this plugin specifically.

    #6677
    optimalpartners
    optimalpartners
    Participant

    I found a place to edit the z index but no matter what I changed it to, it didn’t seem to fix the issue with my menu showing up behind the search icon. One other thing is I saw that I can exclude a certain type of post, however, I need to exclude a certain page. Is there any way of doing this? Thank you!

    #6678
    optimalpartners
    optimalpartners
    Participant

    Sorry, another thing is in the results, I’d like to prioritize certain types of posts over others. For example I would want my posts and pages to show up before a product or an rss feed item.

    And in the preview results, am I able to have headers other than page and post? I’d like to list my feeds items separately if possible, they are a custom post type.

    #6680
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    I’ve invesitvaget the results override problem on my test environment, and there is indeed an issue when the grouping is enabled. I took some time and most likely fixed this problem within the new version (4.6). I’m attaching the release candidate version to this post, please install it, it should solve the problem with the missing results on the default wordpress results page. However grouping on the results page is not possible to add by the plugin. It’s fully controlled by the theme, and I believe it’s only possible to do by changing the code completely in the search.php file in the theme folder.

    I’ve also looked if there is anything I can do about changing the order of the post type groups, but I’m afraid there is nothing I can do right now. Grouping in general is probably the most complicated part of the plugin right now. I’m planning to completely re-work the whole grouping thing with more options, right now it’s a bit too strict and not too friendly. Your request seems fair and square, but the current state of the grouping mechanism does not allow such action unfortunately 🙁

    You can exclude pages by IDs or by parent-child structures on the Advanced Options -> Content panel (scrolling almost to the bottom): https://i.imgur.com/4qW0S3l.png
    The options says Exclude Posts by ID’s (comma separated post ID-s), but it works with pages and custom post types as well 🙂

    Also, this custom CSS code should solve the z-index issue:

    
    .promagnifier,
    .prosettings {
        z-index: 0 !important;
    }
    
    Attachments:
    You must be logged in to view attached files.
    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #6685
    optimalpartners
    optimalpartners
    Participant

    Hi, Thank you so much for your response, I’m planning on trying to get all of this working tomorrow, however I tried installing the new zip file and it wouldn’t let me because the old plugin is still there. How would you recommend installing so that I don’t lose the search info I had set up?

    Thanks again!

    #6686
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    You can just deactivate, delete the old one and install the new. You wont loose any search data 🙂

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #6721
    optimalpartners
    optimalpartners
    Participant

    These fixes work great! Thank you so much!

    As far as the results page, the override is working, however I found an issue and it happened for two separate search terms, let me try to explain.

    I tried searching “higher ed” (no quotes) and for results I got 62 pages, on page 1- I got 1 result which was a feed item (ideally I’d like these to have lowest priority). Then page 2 had 4 results with a mix of pages and posts (pretty much every page or post we have includes the words higher ed). Page 3 also had 4 results, then page 4 gave me a 404 error, but if I went back and clicked page 5, I got 3 results.

    This same idea happened when searching for “university” and page 1 I got 2 results and page 2 had a 404 error despite having 28 pages of results.

    I’m wondering if there’s any way to fix the number of results per page so that it’s consistent, and also so that my pages and posts appear before lower priority things such as a feed item. But I’m also wondering why and how to fix the issue where for some pages I’m getting a 404 error.

    Another issue we found is for example when searching “student” or “college” there are results in the live preview, however no results are returned on the main search results page.

    Thank you again for all your help!

    #6731
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    Thanks for the feedback!

    Based on your description it’s possible 2 things causing the problem:

    1. The plugin is malfunctioning at some point and getting perhaps incorrect post IDs (or something related)
    2. Or/And the theme search.php or some hook does some filtering of the results – which causes the empty pages and the pages with less than four results.

    Unfortunately it’s impossible for me to tell where the problem is exactly without debugging through the search code first and checking the theme search.php file as well. If you can add FTP access I will gladly take a look and suggest a fix if it’s possible.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #6766
    optimalpartners
    optimalpartners
    Participant

    Hi, I updated the information for ftp access. I also found another issue where the sorting categories isn’t working. I did a search, again for higher ed and checked off only feeds, but I’m getting other results as well, see the attached screenshot. I really like how the plugin is intended to work, and I really hope these issues can be resolved, because if not we will probably have to go back to the standard wordpress search. Thank you for all your help!

    I’m also now not able to get any results for my searches. I didn’t change anything with the other search settings.

    Attachments:
    You must be logged in to view attached files.
    #6781
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    I have found out why it wasn’t displaying anything on the search results page. It wasn’t the plugins fault, neither the themes fault. It took me a while, but it turns out there is a an issue with the get_posts() core function. It basically has a parameter to tell it to return “any” post type from the give post array, and it fails to work. I’ve made a tiny change to the search code to bypass this issue. I’m going to notice the WordPress development team about this issue as well.

    About the filter. As I can see you left “Feeds” in there, but I guess you are wondering why do you get Posts as well. The reason is that on the General Options -> Sources panel the Search In Posts option is enabled and the option is disabled. Therefore the plugin is configured not to display the “search in posts” checkbox, and to search in posts by default.

    You can do two things to solve this:
    1. Simply turning OFF the Search In Posts option on the General Options -> Sources panel
    2. ..or leaving the Search In Posts as it is, and turning on the Show search in posts selector? on the Frontend Search Settings -> General panel panel – if you want to let the user decide to search/not to search in posts.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #6787
    optimalpartners
    optimalpartners
    Participant

    Great! It works! Thank you so much! One last question/clarification. I know you said the grouping on the results page isn’t possible currently but maybe in the future, however is there any way to prioritize certain types of results over others? I’d like to have my posts and pages show up before my feed items as those are not my content and are pulled in by a plugin, I think they should show up last if possible. I noticed the priority settings per post/page, but with the feeds, they are constantly being added so I’m not sure if that is ideal.

    Thank you again!

    #6788
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    I’m hoping for the best in terms of grouping, but currently it’s fully controlled by the theme. There are plans to change things in wordpress core to give more control over these aspects, and I’m hoping it’s going to be possible one way or another. Currently unfortunately there is nothing I can do (from the plugins perspective).

    I’m afraid there is nothing I can do with the second issue right now. I remember someone else also asked this same thing this week earlier, and I went to check the code if there is anything I can change up – but unfortunately no. It’s a very valid request, but this part of the engine is one of the most complicated, and to be honest at the time I was building it, I did not think of such feature, so the current state is not changeable. ( I would rather not go into details why excaclty )

    However I’m going to re-work the whole grouping part of the code, as it’s very hard to maintain, and it’s almost impossible to add new features to it – it’s on of the oldest part of the plugins still barely changed. This should happen within 2-3 updates, as the current one I’m preparing for release already has too many changes, and I want to avoid any potential issues transitioning from the current version.

    Sorry for the bad news, I’m doing my best to help with any issue possible. On the bright side, you have the license forever, and I have lots of things planned to make this plugin even better.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #6911
    optimalpartners
    optimalpartners
    Participant

    Hi, after working with my team on some final testing, I found a couple of small issues that I’m hoping you can help me with.

    The first thing is we tried searching for the word “document” for which there are 2 “posts” and 1 “free resource” however if we use the filters to search only within posts, or as a separate search only within the free resources, nothing comes up. I know it is able to find the posts though because without using the filters they show in both the preview and the main results page.

    Also, I’m wondering if I can highlight the search terms in the actual results page. It is working in the preview results, which I noticed can be slow–some of my team members didn’t know that was a feature!

    Also when pages come up in the main search results, there is often, if not always, no text accompanying the title of the page. I’m wondering if there is anything that can be done to have some sort of description of the page show in the results.

    One last thing that I’m not sure if you can assist with, but I thought I’d ask. We are trying to style certain results differently from others based on the type of post. I’m not familiar with the search.php files or the back end of WordPress, but I’ve read that it is possible to make those customizations using loops and if statements with the types of content. The other issue is that some of the content (RSS feeds that we pull in) is displayed in a <p> which will not allow us to style certain parts of it like the author, source, date separately from the main content preview. I realize you may not have the information for this, but thought I’d ask in case you knew of anything that could help.

    Thank you again!

    #6915
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    1. I just tried and it works on my end: https://i.imgur.com/uTi66iY.png
    I disabled the resources and feeds post type filter, and the two posts are there in the results list. I didn’t uncheck the “Free Project Management Courses” and the “Articles” checkbox – it would exclude both of them, because one is in the first category, the other is in the second.

    2. Might be possible actually. The plugin has a built in highlighter script, which could be used to highlight terms on the search page. Try putting this custom script code to the search.php file in your theme directory:

    
    <script>
    jQuery(function($) {
       aspjQuery("main").highlight(aspjQuery(".probox input.orig").val(), { element: 'span', className: 'highlighted', wordsOnly: 0 });
    });
    </script>
    

    and also, you need some custom CSS for it:

    
    span.highlighted {
        font-weight: bold;
        color: #d9312b;
        background-color: #eee;
        background-color: rgba(253, 181, 48, 0.57);
    }
    

    I’m just guessing here, this might not work though.

    3. I guess those pages have either some kind of shortcodes as content or custom code or maybe they are just a permalink for a theme file. The plugin tries to get any content possible. However for example the “Blog Articles” page does not actually have any content, it’s only a permalink to redirect to a theme file. It basically orders wordpress to show something on that permalink. I don’t think it’s possible to show any kind of content on these pages within the search results.

    4. As I can see your current theme already does that for you, you only need the custom styling CSS code. Every article element on the results page is marked with a CSS class based on the post type. I can see these:

      type-post
      type-page
      type-feed

    so you can easily make custom CSS to distinguish each type like. For example to change some styles only on “post” results:

    
    article.type-post {
        /* generic custom CSS code */
    }
    
    article.type-post p {
        /* paragraph, post content custom CSS code */
    }
    
    article.type-post h1,
    article.type-post h1 a {
        /* post title custom CSS code */
    }
    
    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #6942
    optimalpartners
    optimalpartners
    Participant

    Thank you for clarifying how the filters work.
    I’ve been trying several things, as I’d ideally like to have the filter selectors be: Articles (New CPT), Resources (New CPT), Consultants (New CPT), Feeds (Feed Type CPT), Products (Product CPT), Jobs (Category of Feed CPT)
    Note: Currently Articles and Resources only have 1 in each as over the next few weeks/months I’ll be moving all old posts into custom post types so I can organize better with taxonomies. Also, I have not created the Consultants post type yet.
    Right now however, I’m unable to get search results for either of the article or resource CPT (“The Advantages of Hiring Team Members with Non-IT Backgrounds” and “Free Project Management Courses” respectively)
    Note: If you try to search for them, both of these have admin as the author, as they are copies of posts and I have not removed the original posts categorized as article or free project resource due to the testing I’m doing with CPTs as mentioned).
    In trying to figure out how to get the selectors I want, I tried to remove the post and page filters to allow users to filter by category and post type, however if for example I’d only like to search for products, I noticed that pages and posts still showed up. I’d like to be able to select a checkbox and for only those things to show up. Similarly, the other issue here is because Jobs is a category of Feeds, the user must select both feeds and Jobs. I’d like for them to just select Jobs and for those items to show up. (I also don’t like how Jobs has to be displayed separately from the others in the selectors view.) I think the categories of selectors should use an OR rather than an AND operator that way the user can select a category, but not have to select a post type.

    Also, I was trying to see the difference between using the regular engine and the index engine, and then it didn’t seem like my feed items were coming up in search. (The general feed pages came up, but not the individual feed posts) I was also afraid that even with the index extending itself on publish that the feed items wouldn’t be a part of that since they are not stored as posts or pages, and instead they are stored within the WP RSS Aggregator plugin. Because I was unsure of this and didn’t like the way the individual feed items were not showing in the results, I reverted back to the regular engine and removed the index table. However, now I am not getting any RSS feed items (other than Jobs) or custom post types (Resources, or Articles as mentioned above) in my search results. I looked through all of my settings and can’t figure out why neither the feed items or the articles and resource post types will come up for any of my searches – I went to my feed pages and searched for various items that are currently listed and got no results.

    Another thing is, I can’t seem to determine if displaying by category or by post type is better. Similar to above, I’d like the preview results to display grouped as Pages, Articles, Resources, Feeds, Products, and Jobs. And I’ve noticed that other than Jobs, I’m unable to search for any feed items, or the CPTs of articles and resources as mentioned above. I realize it’s a bit confusing right now because the CPTs were being tested in this development environment, but I want to make sure I have the search fully configured before I move it into my production environment.

    Thank you for the Highlighting info, it worked!

    As far as the pages not showing any content in the preview, I tried adding an excerpt to one of my dynamic pages and it displayed in the main search results, but not in the preview results. Not sure if there’s any way to fix this. I know I have it set to search the excerpts.

    Also, thank you for the information about distinguishing the different post types, it was a huge help! I did a bit more research on the rss aggregator plugin and it turns out that plugin does not allow feeds to show up in search results, so it seems as if because I allowed the feed post type to come up in results, something with this search plugin is stripping the html tags and displaying all information in a single paragraph tag. For example, it shows the source, date, and main content all lumped together–we would ideally like to have that information separated, so I’m wondering if there is a way maybe in the code to determine for that post type not to strip the html and differentiate between the sections.

    Thank you again for all of your help!

Viewing 15 posts - 1 through 15 (of 41 total)

You must be logged in to reply to this topic.