I'm trying to create somewhat of a clever search for which only searches through certain pages of my site. At the moment, it can search those pages, but instead of the result returning the page name, I want it to return a field within the matrix field which the search query can be found in.
As an example below, if a user were to search for Lorem Ipsum, I want it to return the page name as well as the matrix field title.
This is my title
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.
Desired result:
Page Name: This is my title
So far, the code I have can be found here, but I'm unsure how to access to exact matrix field title and add it to the query.
{% set query = craft.request.getParam('q') %}
{% set entries = craft.entries.search(query).order('score').section(['pageOne', 'pageTwo', 'pageThree']) %}
{% if entries|length %}
{% for entry in entries %}
<a href="{{ entry.url }}">{{ entry.title }}</a>
{% endfor %}
{% endif %}
Is this possible to achieve?