<p>This seems to work:</p>

<pre><code>{% set entries = craft.entries.section('not lakeDetails').search('title:' ~ query).order('score') %}
</code></pre>

CC BY-SA 3.0
2014-10-02T12:04:26.933Z
2014-10-02T12:04:26.933Z
user1070143
<p>How do I change this template code to only return results from the <em>title</em> field of an entry?</p>

<p>The search result page url would look like this: <code>/search-results?q=joe+blogs</code></p>

<pre><code>{% set query = craft.request.getParam('q') %}
{% set entries = craft.entries.section('not thisSection').search(query).order('score') %}
</code></pre>

<p>Thanks for any help.</p>

<templating><search>
How to search by title field only?
# How to search by title field only?

(Asked by: username_0 on 2014-10-02)

How do I change this template code to only return results from the title field of an entry?
The search result page url would look like this: /search-results?q=joe+blogs
{% set query = craft.request.getParam('q') %}
{% set entries = craft.entries.section('not thisSection').search(query).order('score') %}

Thanks for any help.

**Tags:** templating, search


---

## 1 answers

### Answer by username_0 on 2014-10-02. Score: 6 | Accepted answer

This seems to work:
{% set entries = craft.entries.section('not lakeDetails').search('title:' ~ query).order('score') %}


---

