Site Search with Dynamic Pages Using Custom Objects

SOLVE
rOsborn123
Contributor | Elite Partner

I have dynamic pages set up using custom objects as well as a site search tool. The page for my dynamic pages is set up as a Website Page, and I have "Website Pages" enabled on my site search module / tool. The path for my main listing page is "/products". When I search for a specific product using the site search tool, rather than showing the specific detail page, the site search is just returning the general listing page. 

So, for example, when I search "history book", rather than showing:

History Book (/products/history-book)

in the results from my site search, I'm instead just seeing:

Product Listing (/products)

What step could I be missing here to instead show the detail page of a product rather than a general listing page?

0 Upvotes
1 Accepted solution

Accepted Solutions
dennisedson
Solution
Community Manager
@rOsborn123,
This functionality does not exist, yet. I confirmed with the team and they said that they are working on it and will let me know when it is complete, but didn't have a firm timeline.
Thanks,

Dennis




Check out our Community Developer Blog
where we feature our Community driven developer podcast and how to content

View solution in original post

0 Upvotes
9 Replies 9
Teun
Guide | Diamond Partner

Hi @rOsborn123 ,

 

Are you using the default site search functionality or the contentsearch API?
Could you check if you have an option to include dynamic pages in the template settings if you are using the default functionality? It currently shows nothing on dynamic pages in the docs, but it might be there.

If you are using the API, the dynamic pages should be included in the results, unless you're blocking them with the robots.txt or have set the &type= to only search within a specific page type.

Did my answer solve your issue? Help the community by marking it as the solution.
rOsborn123
Contributor | Elite Partner

Thanks for the response, @Teun 

I'm attempting to use the default site search functionality, and Dynamic Pages is not an option in the template editor. 

Furthermore, I've attempted using the contentsearch API and am getting the same results where the listing page shows but the detail pages do not - for context, I am not supplying a type so should receive all pages that match the query regardless of page type.

Lastly, I've double checked my settings and the page is not being blocked by the robots.txt 

0 Upvotes
Teun
Guide | Diamond Partner

I'll call in the big guns. @dennisedson is searching for dynamic pages created with a Custom Object possible using the default search functionality or the API?

Did my answer solve your issue? Help the community by marking it as the solution.
0 Upvotes
dennisedson
Solution
Community Manager
@rOsborn123,
This functionality does not exist, yet. I confirmed with the team and they said that they are working on it and will let me know when it is complete, but didn't have a firm timeline.
Thanks,

Dennis




Check out our Community Developer Blog
where we feature our Community driven developer podcast and how to content

View solution in original post

0 Upvotes
Teun
Guide | Diamond Partner

@dennisedson Thank you for the update! Good to know for future projects.

Did my answer solve your issue? Help the community by marking it as the solution.
miljkovicmisa
Top Contributor | Gold Partner

Hello @rOsborn123 , there is also the &pathPrefix= query parameter, depending on how your pages are set you could use that to limit the pages returned only from a certain path, let's say you have your dynamic pages in the url expample.com/users/:user, you could limit your search results only to the /users path, with &pathPrefix=users.

There is some documentation on how this works, in this link.
You can also tweak the original search module by cloning it and then adding this query parameter in the javascript. It should be in line 80 where the getSearchResults function for returning results is, and there you can find the requestUrl variable that has a string for the query, just put &pathPrefix=users there and you should be good to go.

 

If my answer was helpful please mark it as a solution.

Teun
Guide | Diamond Partner

@rOsborn123 , this is some great advice to check if the dynamic pages are available in the search results. What happens if you change the `&pathPrefix=` to `&pathPrefix=products` ?
Could you maybe share the URL you are searching on, we could use postman to run some tests ourselves.

Did my answer solve your issue? Help the community by marking it as the solution.
rOsborn123
Contributor | Elite Partner

@Teun @miljkovicmisa Thanks for the support and advice. There seems to be something with the dynamic pages generated from custom objects that is not allowing the "/products/:product" pages to be indexed, however.

I attempted your recommendation adding `&pathPrefix=products` in a request to the "contentsearch/v2/search" endpoint. The response returns old pages with a "/products-testing/" path in the results that pull from HubDb as well as the listing page "/products" that is leveraging the custom objects dynamic page tool, but the individual detail pages for products are not in the response.


Here's the URL of the listing page that I'm working with. To reiterate, they are not being disallowed in the robots.txt file, so I'm not sure what else may be conflicting here in regards to blocking them from being searched using the "contentsearch/v2/search" endpoint.

0 Upvotes
Teun
Guide | Diamond Partner

Hi @rOsborn123 , check @dennisedson his comment. It sadly isn't available yet. They are working on it tho.

Did my answer solve your issue? Help the community by marking it as the solution.