---
title: "Search results with highlighting and field selection"
description: "Build search interface with highlighted terms, field selection, and multiple filters"
source: https://apitube.io/cookbook/search-results-with-highlighting-and-field-selection
---

#### Input parameters

| Parameter   | Description                                    | Type    | Default | Required |
|:------------|:-----------------------------------------------|:--------|:--------|:---------|
| title       | Search query.                                   | string  |         | Yes      |
| fl          | Field selection for optimization.               | string  |         | Yes      |
| hl          | Enable highlighting.                             | boolean | true    | Yes      |
| hl.fl       | Fields to highlight.                            | string  |         | Yes      |
| per_page    | Maximum number of articles to retrieve.       | integer | 20      | Yes      |
| sort.by     | Sort by relevance.                              | string  |         | Yes      |
| sort.order  | Descending order.                               | string  |         | Yes      |
| api_key     | Your API key.                                  | string  |         | Yes      |

#### Workflow examples

##### Request for search results with highlighting:

```shell
curl -X GET "https://api.apitube.io/v1/news/everything?title=AI&fl=id,title,description,published_at,source.name&hl=true&hl.fl=title,description&per_page=10&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY"
```

##### Request with custom highlight tags for HTML:

```shell
curl -X GET "https://api.apitube.io/v1/news/everything?title=Tesla&hl=true&hl.tag.pre=<mark>&hl.tag.post=</mark>&api_key=YOUR_API_KEY"
```

##### Request with larger snippets and more results:

```shell
curl -X GET "https://api.apitube.io/v1/news/everything?title=climate%20change&hl=true&hl.fragsize=300&hl.snippets=5&api_key=YOUR_API_KEY"
```

##### Request combined with filters:

```shell
curl -X GET "https://api.apitube.io/v1/news/everything?title=Apple&organization.name=Apple&hl=true&hl.fl=title,description&sentiment.overall.polarity=positive&published_at.start=2024-01-01&api_key=YOUR_API_KEY"
```

---

#### Related Examples

- [Select specific fields](/cookbook/select-specific-fields-to-reduce-payload-size)
- [Efficient large dataset retrieval](/cookbook/efficient-large-dataset-retrieval-with-field-selection)
- [Search for exact phrases in titles](/cookbook/search-for-exact-phrases-in-article-titles)
- [Comprehensive analytics dashboard](/cookbook/comprehensive-analytics-dashboard-query)
- [Sort by engagement score](/cookbook/sort-articles-by-engagement-score)

