Answers.Body: <p>I assume, that title is a subfield of a matrix field, because title is a reserved name in craft. So as far as I understand your Question, you want to get some results out of a matrix field thats in one of your pages ('pageOne', 'pageTwo', 'pageThree'). That means you have to loop over this field as well. </p>
  
  <pre><code>{% if entries|length %}
     {% for entry in entries %}
         {% for block in entry.matrixFieldHandle %}
            &lt;a href="{{ entry.url }}"&gt;{{ entry.title }} - {{ block.matrixTitle }}&lt;/a&gt;
         {% endfor %}
     {% endfor %}
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-08T09:49:36.350Z
Answers.Text: Perfect! Thank you
Answers.UserDisplayName: Amy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-08T09:51:49.763Z
Answers.Text: Your Welcome. I just realized, that title is also forbidden inside a matrix field, so i changed the handle inside the block to 'pageName' ;)
Answers.UserDisplayName: Laslo89
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-08T09:52:57.263Z
Answers.Text: What you had was perfect, {{ block.title }} was what gave me the field title. just needed both {{ entry.title }} - {{ block.title }} for page name and field name :)
Answers.UserDisplayName: Amy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-08T10:28:32.573Z
Answers.Text: @Amy I'm just curious: how were you able to insert `title` as a field handle in your craft matrix field? `title` is a reserved keyword it's usually not possible to use it as a handle
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-08T10:32:37.333Z
Answers.Text: The section I was looking to search through was a Q&A section, so my title was {{ entry.question }}. You are right, you cannot use just 'title', bad example on my part
Answers.UserDisplayName: Amy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-08T09:43:34.147Z
Answers.LastActivityDate: 2018-02-09T07:05:45.260Z
Answers.LastEditDate: 2018-02-09T07:05:45.260Z
Answers.UserDisplayName: Laslo89
Body: <p>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.</p>
  <p>As an example below, if a user were to search for <em><strong>Lorem Ipsum</strong></em>, I want it to return the page name as well as the matrix field title.</p>
  <blockquote>
  <p><strong>This is my title</strong></p>
  <p>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.</p>
  </blockquote>
  <p>Desired result:</p>
  <blockquote>
  <p>Page Name: This is my title</p>
  </blockquote>
  <p>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.</p>
  <pre><code>{% 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 %}
          &lt;a href=&quot;{{ entry.url }}&quot;&gt;{{ entry.title }}&lt;/a&gt;
      {% endfor %}
  {% endif %}
  </code></pre>
  <p>Is this possible to achieve?</p>
  
Tags: <matrix><search><field><query>
Title: Search and link to Entries Matrix Field
ThreadText: # Search and link to Entries Matrix Field
  
  (Asked by: username_0 on 2018-02-08)
  
  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?
  
  **Tags:** matrix, search, field, query
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-02-08. Score: 2 | Accepted answer
  
  I assume, that title is a subfield of a matrix field, because title is a reserved name in craft. So as far as I understand your Question, you want to get some results out of a matrix field thats in one of your pages ('pageOne', 'pageTwo', 'pageThree'). That means you have to loop over this field as well.
  
  ```
  {% if entries|length %}
     {% for entry in entries %}
         {% for block in entry.matrixFieldHandle %}
            <a href="{{ entry.url }}">{{ entry.title }} - {{ block.matrixTitle }}</a>
         {% endfor %}
     {% endfor %}
  {% endif %}
  
  ```
  
  > **Comments:**
  > **username_0**: Perfect! Thank you  
  > **username_1**: Your Welcome. I just realized, that title is also forbidden inside a matrix field, so i changed the handle inside the block to 'pageName' ;)  
  > **username_0**: What you had was perfect, {{ block.title }} was what gave me the field title. just needed both {{ entry.title }} - {{ block.title }} for page name and field name :)  
  > **username_2**: @username_0 I'm just curious: how were you able to insert `title` as a field handle in your craft matrix field? `title` is a reserved keyword it's usually not possible to use it as a handle  
  > **username_0**: The section I was looking to search through was a Q&A section, so my title was {{ entry.question }}. You are right, you cannot use just 'title', bad example on my part  
  
  ---
  
  