# Constrained Searches

Constraining searches enables the search browser to return fewer candidate matches. This is opposite to extending searches (see [**Extended Searches**](https://docs.snomed.org/snomed-ct-practical-guides/snomed-ct-search-and-data-entry-guide/4-optimizing-searches/4.3-extended-searches)). The intention of constraining a search is to avoid getting a long list of search results to scroll through. This shortens the time the user needs to find the required Concept, thereby increasing the usability of the application.

## Constrain searches by excluding "stop words"

Frequently used words with limited semantic specificity can be excluded from search indexes to improve the speed and specificity of searches. Examples of English words typically included in "stop word" lists include: a, an, and, as, at, be, by … of … the, etc.

General purpose search software often includes a default list of "stop words" but these may not be entirely appropriate for SNOMED CT searches. For example, the MySQL default "Full-Text Stopwords" includes "no", "non", "not", "without" and many other words which may be highly significant when searching for clinical terms.

The SNOMED CT International Release includes a suggested "stop list" (referred to as the *ExcludedWords* Table). This is only available in English and is the list of exclusions used when generating keyword lists distributed with the same release.

<figure><img src="https://655065570-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCEAcChvWjWEu16YmwNrz%2Fuploads%2Fgit-blob-2cd8b77cd820865a79bcfa4004eaa2ff76c8742c%2F57815673.png?alt=media" alt=""><figcaption><p>Constraining words in any order searches by excluding stop-words - step 1</p></figcaption></figure>

<figure><img src="https://655065570-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCEAcChvWjWEu16YmwNrz%2Fuploads%2Fgit-blob-09b2e4a3e397eafb4fd910000da879d0435523c8%2F57815675.png?alt=media" alt=""><figcaption><p>Constraining words in any order searches by excluding stop-words - step 2</p></figcaption></figure>

## Constrain Searches by Status

Searches should usually be filtered so that only Active Descriptions associated with Active Concepts are returned.

There are a few use cases where a user may legitimately wish to search *Inactive Concepts* and *Descriptions.* Possible cases include creating or editing queries that locate previously entered data recorded using *Concepts* and *Descriptions* that are no longer recommended for *active* use. Therefore, searches intended to be used for these cases should allow the default active status filter to be disabled.

<figure><img src="https://655065570-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCEAcChvWjWEu16YmwNrz%2Fuploads%2Fgit-blob-b2c85d18a467abf244961eeda3fcea4af8606dc2%2F52171330.png?alt=media" alt=""><figcaption><p>Constraining searches by filtering by active status</p></figcaption></figure>

{% hint style="danger" %}
**Important Note**

For use cases involving data entry or design of data entry template or Reference Set, this filter should always be applied and set as active. This should not even be a filter option.
{% endhint %}

## Constrain Searches by Supertype Ancestors

Searches may usefully be limited to *Concepts* that have a specified supertype ancestor, which is appropriate for the context of a particular field, template or protocol.

### Example

When attempting to record the diagnosis "renal calculus," it is not helpful for a search to include the procedures that may be carried out to treat a renal calculus.

<figure><img src="https://655065570-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCEAcChvWjWEu16YmwNrz%2Fuploads%2Fgit-blob-0e38085c806a640c6ca3ccd5ba69cf18e7f77317%2F52170499.png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://655065570-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCEAcChvWjWEu16YmwNrz%2Fuploads%2Fgit-blob-364337fcec46a3f6b947e5c3b762e357cef2059e%2F52170500.png?alt=media" alt=""><figcaption><p>Constraining the search by filtering by supertype ancestors</p></figcaption></figure>

## Constrain Searches by Reference Sets

Searches for Descriptions or Concepts may need to be constrained by Reference Sets. Applications should allow searches to be filtered, ordered or otherwise prioritized in accord with one or more active Reference Sets. Specifically, the search mechanism should support the following functions with respect to the following types of Reference Sets:

* A Simple Reference Set may be used to filter, sort or highlight the results of text search or hierarchical navigation. This may simplify or encourage selection of Concepts or Descriptions used in a particular country, organization or specialty.
* A Simple Reference Set or an Ordered Reference Set may be used to specify or order the valid Concepts for entry in a particular field.

Reference Set may also be used to exclude subsets of Concepts and Descriptions that are not relevant or appropriate in browsers and in-built search functionalities. For example, it may be beneficial for the search not to return any members of the non-human Reference Set, unless the search is explicitly customized to include them.

## Constrain Searches by Language or Dialect

Constraining searches by language or dialect is a type of constraining by Reference Sets. For every translated version of SNOMED CT, this technique is mandatory. Filtering of search and navigation results to include only those Descriptions that are referenced by the Language Reference Sets may be applied to limit a search to those Descriptions applicable in a particular language or dialect. A single common encoding language should be mandatory in search use cases directly connected to data entry, to avoid confusion and ambiguity. There are a few use cases where a user may legitimately wish to search for Descriptions included in extensions of other countries *.* For example, when mapping SNOMED CT to other code sets, en-US (American) Descriptions may be required if extensions are not available in the UK language Reference Set.

<a href="https://docs.google.com/forms/d/e/1FAIpQLScTmbZIf0UEQwYDkY27EEWBkaiYkHSbR0_9DmFrMLXoQLyL7Q/viewform?usp=pp_url&#x26;entry.1767247133=Search+And+Data+Entry+Guide&#x26;entry.670899847=Constrained%20Searches" class="button primary">Provide Feedback</a>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.snomed.org/snomed-ct-practical-guides/snomed-ct-search-and-data-entry-guide/4-optimizing-searches/4.4-constrained-searches.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
