<p>I don't think it will be possible using the native Craft search engine as part of the search keyword normalization process involves removing all punctuation from the keywords: <a href="https://github.com/craftcms/cms/blob/develop/src/helpers/Search.php#L62" rel="nofollow noreferrer">https://github.com/craftcms/cms/blob/develop/src/helpers/Search.php#L62</a></p>

<p>It might be possible on front-end searching using something like Algolia, though:
 <a href="https://plugins.craftcms.com/algolia" rel="nofollow noreferrer">https://plugins.craftcms.com/algolia</a></p>

CC BY-SA 4.0
2019-08-20T23:00:35.383Z
2019-08-20T23:00:35.383Z
Brad Bell
<p>Many thanks for clarifying Brad - have worked out a solution at a plugin level basically querying the craft content table directly via a database query then passing the corresponding element IDs into my <code>craft.entries</code> call:</p>

<pre><code>$query = (new Query())
        -&gt;select(['elementId'])
        -&gt;from(['{{%content}}'])
        -&gt;where(['like','field_jobs_jobTitle',$keyWords])
        -&gt;orWhere(['like','field_jobs_description',$keyWords]);

    $entryIds = [];
    foreach ($query-&gt;all() AS $item) {
        $entryIds[] = (int)$item['elementId'];
    }
    $criteria['id'] = $entryIds
</code></pre>

CC BY-SA 4.0
2019-08-22T11:36:05.623Z
PS if you are aware of a way to pass parameters eg `[':keywords' => $keywords]` into a `like` DB query then do let me know!
Cole Henley
CC BY-SA 4.0
2019-08-22T11:35:14.277Z
2019-08-22T11:35:14.277Z
Cole Henley
<p>We have a job inventory where the jobs are being saved as entries.
When searching against jobs by keyword we search against two fields: the title and a job description field.</p>

<p>However we are experiencing some unusual results when using the <code>search</code> parameter to search against the term <code>".net"</code>. For example:</p>

<pre><code>{% set results = craft.entries()
.search('title:".net" OR description:".net"')
.all() %}
</code></pre>

<p>Is there a way to use <code>search()</code> to specifically only return entries where the title or description contains <code>.net</code> as at present it is returning partial matches (eg jobs where the title or description features 'networking'). </p>

<p>The description field is a redactor/rich text field. Would this affect it?</p>

<craft3><search>
Search question: dot (period) and partials
# Search question: dot (period) and partials

(Asked by: username_0 on 2019-08-20)

We have a job inventory where the jobs are being saved as entries.
When searching against jobs by keyword we search against two fields: the title and a job description field.
However we are experiencing some unusual results when using the search parameter to search against the term ".net". For example:
{% set results = craft.entries()
.search('title:".net" OR description:".net"')
.all() %}

Is there a way to use search() to specifically only return entries where the title or description contains .net as at present it is returning partial matches (eg jobs where the title or description features 'networking'). 
The description field is a redactor/rich text field. Would this affect it?

**Tags:** craft3, search

---

## 2 answers

### Answer by username_1 on 2019-08-20. Score: 1

I don't think it will be possible using the native Craft search engine as part of the search keyword normalization process involves removing all punctuation from the keywords: <https://github.com/craftcms/cms/blob/develop/src/helpers/Search.php#L62>

It might be possible on front-end searching using something like Algolia, though:
<https://plugins.craftcms.com/algolia>


---

### Answer by username_0 on 2019-08-22. Score: 0

Many thanks for clarifying Brad - have worked out a solution at a plugin level basically querying the craft content table directly via a database query then passing the corresponding element IDs into my craft.entries call:
$query = (new Query())
        ->select(['elementId'])
        ->from(['{{%content}}'])
        ->where(['like','field_jobs_jobTitle',$keyWords])
        ->orWhere(['like','field_jobs_description',$keyWords]);

    $entryIds = [];
    foreach ($query->all() AS $item) {
        $entryIds[] = (int)$item['elementId'];
    }
    $criteria['id'] = $entryIds

> **Comments:**
> **username_0**: PS if you are aware of a way to pass parameters eg `[':keywords' => $keywords]` into a `like` DB query then do let me know!  

---

