Excluding posts/pages/cpts does not work

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Excluding posts/pages/cpts does not work

This topic contains 5 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 1 year ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #33029
    MarioLadani03
    MarioLadani03
    Participant

    I have the problem, that my ajax search lists results that should be excluded as visible in the attachment. For example, even though I added both IDs of my wpforms, it still continues to search those and also highlights them via span.asp_single_highlighted_1, when I click on one of the results.
    Also when trying to drag other items from the left field to the right (see screenshot), after I click save, only the two items stay in the exclude box on the right side, everything else gets deleted.

    As you can see I also tried excluding via ID, which does not seem to work either.
    One good example is the search term “erwerbs” which finds results on the start page and the contact page, even though there is no mention of it on the start page other than in the menu.

    Am I missing some option I did not activate?

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

    Hi,

    That option is to exclude results from showing up – not to exclude sections or elements from a specific page. The plugin searches the database of the selected field, so if a result is found, then the keyword must be there in either of the selected fields.
    If you want to exclude the start page and the contact page for example, then make sure the correct post type is selected at the exclusion: https://i.imgur.com/eCpJmHO.png

    Excluding the “wpforms” post type will have no effect whatsoever, because those are only storage post types for the wpforms plugin, and are not actually searchable.

    If you want to exclude certain shortcodes contents from the search, then I recommend using the index table engine instead. There, you can tell the indexer to ignore some shortcodes: https://i.imgur.com/0sa1ujR.png
    If the forms contents are integrated via shortcode, then adding the shortcode to the exceptions list will ignore page/post matches based on the forms content.

    Best,
    Ernest Marcinko

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


    #33063
    MarioLadani03
    MarioLadani03
    Participant

    Hi Ernest,

    Thank you very much for your help, the exclusion of certain shortcodes using the index table engine works great!

    Also, thank you for showing me how to exclude whole pages such as the home page and the contact page, but as far as I understand, this is not really something I’m trying to achieve.
    What I want to do is exclude my main menu and my footer from the search results. I will try to give you a more detailed description of an example.

    1) Using the search term “erwerbs”, I get the following results, including the page “Alters- und Hinterlassenenverischerung”: https://abload.de/img/ahv_searchd0jdr.jpg

    2) I click on the search result and get redirected to that page. Using the dev tools, I search for the term “erwerbs” inside the source code of the rendered page, but the only hits I get are from the header (main menu) and the footer of the page: https://abload.de/img/erwerbs_on_ahvq9kvz.jpg

    Is there any way of excluding the entire header and footer area of all pages from the search?
    I am assuming exluding the footer (like this: https://abload.de/img/footer_post_type8dkbp.jpg) here does not work, because et_pb_layout is just a storage post type, correct?

    Hope this description is a bit clearer, my last one was wishy-washy.

    Thanks in advance!

    • This reply was modified 1 year ago by MarioLadani03 MarioLadani03. Reason: added a screenshot
    #33067
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Thank you I understand now.

    Unless the menu is part of the actual page content in the editor, then the match is coming from somewhere else. The plugin looks in the database, not the printed content itself. The usual suspects can be selected custom fields (if any), or taxonomy terms (categories, tags etc..). Fin
    If the menu in the footer is actually built to the page itself, then you can still try using negative keywords: https://i.imgur.com/zCVUGVS.png

    Best,
    Ernest Marcinko

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


    #33101
    MarioLadani03
    MarioLadani03
    Participant

    Just to get a better understanding and maybe find the issue myself, am I right in assuming, that ASP sends the following query to the DB when I search for “erwerbs”:SELECT * FROMwp_postswhere post_content LIKE '%erwerbs%'; Is that correct?
    I realise it is probably a bit more complicated but is this the right direction?

    Is there any way to debug your plugin in the front end to find out where the search found its results?

    —-

    So yes, turns out some content that was inserted into the system and hidden afterswards was still being found by ASP.
    Removing it resolved the issue.

    Thank you very much for your help!

    #33103
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Something similar yes, but much more complicated. With the index table engine it is completely different, it does not query the posts table at all, but a custom generated table with keyword occurences.

    I created a test search, and enabled the search in the post contents only, and the result was found. Then I switched to search in titles only, to make sure it works correctly, and then the result was not found anymore.That means, the keyword is within the post content field for sure.
    You can try looking up the posts database table directly, to see where exactly that keyword is printed. Maybe it is used in some sort of a data structure, which is later processed or removed in the front-end view. However it is definitely there in the database, otherwise it would not match.

    Best,
    Ernest Marcinko

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


Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.