I have a Low:Search result that is a child entry in a relationship, for which I wish to point at it's parent entry.
The child doesn't have its own URL that resolves, it just resides within its parent index. The entries in the other collection have URLs that resolve.
I tried to redirect from the child URL to its parent. No luck, perhaps a parse order issue?
I also tried to set the inner html - that displays the content - based on a conditional within the {low_search:results} tag, using 'collection_name', but it also isn't working. I receive a message that the page cannot be properly displayed.
The only way I can get it to work is if I have 2 duplicate {low_search:results} tags, targeting each collection separately, as per Group Low Search results by channel/collection?, but I get both a result set and a 'Sorry, no results' message as both tags are firing, but the keywords are not in both collections.
I must be missing something obvious, as relationships have been around a long time in EE.
Can anyone with a clear head see what I'm missing?
Thanks very much for reading.
Code example - I don't expect this to work as is, but this structure is what I was hoping would work...
{exp:low_search:results query="{segment_3}" limit="10"}
{if count == 1}
{if low_search_keywords}<p>Term searched for: <strong>{low_search_keywords}</strong>.</p>{/if}
<p>Total results: <strong>{absolute_results}</strong>.</p>
{/if}
{if channel == "members"} {!-- child of 'bands' --}
<div class="entry" style="clear: both;">
<h3><a href="/band-members">{title}</a></h3>
<p>{low_search_excerpt}</p>
</div>
{/if}
{if channel == "musicians"} {!-- no children --}
<div class="entry" style="clear: both;">
<h3><a href="{page_url}">{title}</a></h3>
<p>{low_search_excerpt}</p>
</div>
{/if}
{paginate}
<p>Page {current_page} of {total_pages} pages {pagination_links}</p>
{/paginate}
{if low_search_no_results}
<p>Sorry, your query did not return any results. Check your spelling or try a different search term.</p>
{/if}
{/exp:low_search:results}
Working code:
{if channel_short_name == "members"}
<div class="entry">
{parents field="cf-members_item"}
<h3><a href="{parents:page_url}">{title}</a></h3>
{/parents}
<p>{low_search_excerpt}</p>
</div>
{if:else}
<div class="entry">
<h3><a href="{page_url}">{title}</a></h3>
<p>{low_search_excerpt}</p>
</div>
{/if}