I have several custom post types set up using Toolset and have followed the directions on Relevanssi's site here:
hidden link
But search terms within a custom post type are not coming up in results.
For example, I have books (a custom post type) that live on country pages (another custom post type). Books do not have their own pages. When I search by country name, the country shows up in search results, but the country does not show up when I search for a book that is on the country page.
For example, the book "Momo" is on the Germany Books page:
hidden link
If I search for "germany," the Germany Books page shows in search without a problem. But if I search for "Momo," it says no results found:
hidden link
I have shortcodes expanded and have read through several Toolset articles but have not found a solution. I've contacted Relevanssi and they said that there must be a compatibility issue with Toolset or that the shortcodes aren't expanding, even though I have made sure to check the box to do so.
Hi, to some degree it depends on how the View you want to index is displayed in the page. For example, if you insert the View in a Content Template that is applied to the custom post type's single post pages, Relevanssi doesn't index those results because they are not directly part of the post's content. Can you tell me more about how the View is displayed on the Germany Books page, for example?
I have a CPT and a content template for Countries, which have a relationship with Books. On the Countries content template, there is a view that includes the books related to that country. Is there other info I can provide? Or I can provide backend access.
I don't think I need backend access right now. As I was saying, the results of a View will not be indexed if the View is placed in a Content Template assigned to the Country post type. Instead, you can copy + paste the View shortcode into the post body of every Country post in the post type, and remove the View from the Content Template. Then rebuild the index, and the View's contents should be indexed appropriately.
I've done that as a test on two countries, rebuilt the index, and still cannot search for the content on the page. Ex:
hidden link You can see the content is duplicated due to to the fact the shortcode is in the content template and on the country CPT itself. But after rebuilding the index, I searched for some words on the page (Berlin noir, Bernie Gunther, etc.) and they did not show in site search.
Okay then it's probably best for me to log in and take a look. Can you provide login credentials in the private reply fields here?
Okay I see, my instructions were not clear enough. The shortcode must be placed inside the post's main content editor, not in a custom field. The main content editor was disabled in the post type editor screen (see the screenshot), so I re-enabled it and added the View shortcode in the main post content for this post: hidden link. After that I rebuilt the Relevanssi index, and now when I search, I can see the Germany Books post appear in the search results: hidden link
You must add the View shortcode to each Country post in order for it to be indexed.
That did the trick! Thank you so much!
My issue is resolved now. Thank you!