<h3 id="problem-hcfp">Problem</h3>
<p>If you look at the source of your <a href="https://www.levellegal.com/search/results?sa=Search&amp;q=antitrust" rel="nofollow noreferrer">search result page</a>, you'll notice that the search result that points to the search result page (at the time of writing, the second <strong>antitrust</strong> link) has in fact an empty URL.</p>
<p><em>Snippet of the source of the search result page:</em></p>
<pre><code>&lt;ul&gt;
    &lt;li&gt;&lt;a href=&quot;https://www.levellegal.com/what-we-do/antitrust&quot;&gt;Antitrust&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;&quot;&gt;Antitrust&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;https://www.levellegal.com/what-we-do/for-compliance-counsel&quot;&gt;Compliance&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;https://www.levellegal.com/news/managing-antitrust-reviews-that-span-multiple-jurisdictions&quot;&gt;Managing antitrust reviews that span multiple jurisdictions&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;https://www.levellegal.com/news/navigating-second-requests-in-cross-border-antitrust-merger-reviews&quot;&gt;Navigating Second Requests in Cross-Border Antitrust Merger Reviews&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;https://www.levellegal.com/who-we-are/our-people/sarah-young&quot;&gt;Sarah Young, JD&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;https://www.levellegal.com/who-we-are/our-people/jeffrey-morgan&quot;&gt;Jeffrey Morgan, JD&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;https://www.levellegal.com/who-we-are/our-people/albert-azagra-malo&quot;&gt;Albert Azagra-Malo, LLB, LLM, JSD (PhD in Law)&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;https://www.levellegal.com/&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&quot;https://www.levellegal.com/news/how-alsps-stack-up-against-the-big-4&quot;&gt;​How ALSPs stack up against the Big 4&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</code></pre>
<h3 id="solution-aun4">Solution</h3>
<p>You can try adding the following to your search query: <code>.uri('not :empty:')</code>. It will filter out entries from sections that don't have a URL.</p>
<p>Example:</p>
<pre><code>{% set searchTerm = craft.app.request.getParam('q') %}
{% set searchResults = craft.entries.search(searchTerm).uri('not :empty:').orderBy('score') %}
</code></pre>

CC BY-SA 4.0
2021-07-20T11:02:48.790Z
2021-07-20T11:02:48.790Z
nstCactus
<p>Without access to the code, it's hard to tell you where the error lies. There are multiple ways to build a search functionality both using built-in Craft functionality, custom code or external services. If your site is using the regular <a href="https://craftcms.com/docs/3.x/searching.html" rel="nofollow noreferrer">craft search functionality</a>, you could probably fix this by adjusting which sections can be found using the <a href="https://craftcms.com/docs/3.x/entries.html#section" rel="nofollow noreferrer">.section query parameter</a>. If your search is custom-built, you will need to either modify your search parameters so the search page itself can't be found, or – if your search uses a custom index – make sure the search results page can't end up in the index itself.</p>

CC BY-SA 4.0
2021-07-07T07:22:49.587Z
2021-07-07T07:22:49.587Z
MoritzLost
<p>On the site levellegal.com, when you search for certain words or phrases, one of the URL's in the search results will be the search results itself. A good example is to search for &quot;antitrust&quot;. The first result is correct, the second result is the anomaly. Otherwise the search works fine. We didn't build the site, so not real familiar with it.</p>

<search>
Search results URL appearing in search results
# Search results URL appearing in search results

(Asked by: username_0 on 2021-07-07)

On the site levellegal.com, when you search for certain words or phrases, one of the URL's in the search results will be the search results itself. A good example is to search for "antitrust". The first result is correct, the second result is the anomaly. Otherwise the search works fine. We didn't build the site, so not real familiar with it.

**Tags:** search


---

## 2 answers

### Answer by username_1 on 2021-07-20. Score: 1

Problem
If you look at the source of your search result page, you'll notice that the search result that points to the search result page (at the time of writing, the second antitrust link) has in fact an empty URL.
Snippet of the source of the search result page:

    Antitrust
    Antitrust
    Compliance
    Managing antitrust reviews that span multiple jurisdictions
    Navigating Second Requests in Cross-Border Antitrust Merger Reviews
    Sarah Young, JD
    Jeffrey Morgan, JD
    Albert Azagra-Malo, LLB, LLM, JSD (PhD in Law)
    Home
    ​How ALSPs stack up against the Big 4


Solution
You can try adding the following to your search query: .uri('not :empty:'). It will filter out entries from sections that don't have a URL.
Example:
{% set searchTerm = craft.app.request.getParam('q') %}
{% set searchResults = craft.entries.search(searchTerm).uri('not :empty:').orderBy('score') %}


---

### Answer by username_2 on 2021-07-07. Score: 1

Without access to the code, it's hard to tell you where the error lies. There are multiple ways to build a search functionality both using built-in Craft functionality, custom code or external services. If your site is using the regular [craft search functionality](https://craftcms.com/docs/3.x/searching.html), you could probably fix this by adjusting which sections can be found using the [.section query parameter](https://craftcms.com/docs/3.x/entries.html#section). If your search is custom-built, you will need to either modify your search parameters so the search page itself can't be found, or – if your search uses a custom index – make sure the search results page can't end up in the index itself.


---

