Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ firecrawl search "AI data tools"
| `--location <location>` | Geo-targeting (e.g., "Germany", "San Francisco,California,United States") |
| `--country <code>` | ISO country code (default: US) |
| `--timeout <ms>` | Timeout in milliseconds (default: 60000) |
| `--highlights` | Return query-relevant highlights for each result |
| `--no-highlights` | Keep the original search snippets |
| `--ignore-invalid-urls` | Exclude URLs invalid for other Firecrawl endpoints |
| `--scrape` | Enable scraping of search results |
| `--scrape-formats <formats>` | Scrape formats when `--scrape` enabled (default: markdown) |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "firecrawl-cli",
"version": "1.19.26",
"version": "1.19.27",
"description": "Command-line interface for Firecrawl. Scrape, crawl, and extract data from any website directly from your terminal.",
"main": "dist/index.js",
"bin": {
Expand Down
17 changes: 17 additions & 0 deletions src/__tests__/commands/search.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,23 @@ describe('executeSearch', () => {
});
});

it('should allow highlights to be disabled', async () => {
mockHttpPost.mockResolvedValue(mockSearchResponse({ web: [] }));

await executeSearch({
query: 'test query',
highlights: false,
});

expect(mockHttpPost).toHaveBeenCalledWith(
'/v2/search',
expect.objectContaining({
highlights: false,
query: 'test query',
})
);
});

it('should pass apiUrl to getClient when provided', async () => {
mockHttpPost.mockResolvedValue(mockSearchResponse({ web: [] }));

Expand Down
4 changes: 4 additions & 0 deletions src/commands/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ export async function executeSearch(
integration: 'cli',
};

if (options.highlights !== undefined) {
searchParams.highlights = options.highlights;
}

// Add sources if specified
if (options.sources && options.sources.length > 0) {
searchParams.sources = options.sources.map((source) => ({
Expand Down
9 changes: 9 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,14 @@ function createSearchCommand(): Command {
'Exclude URLs invalid for other Firecrawl endpoints',
false
)
.option(
'--highlights',
'Return query-relevant highlights for each search result'
)
.option(
'--no-highlights',
'Keep the original search snippets instead of returning highlights'
)
.option('--scrape', 'Enable scraping of search results', false)
.option(
'--scrape-formats <formats>',
Expand Down Expand Up @@ -1022,6 +1030,7 @@ function createSearchCommand(): Command {
country: options.country,
timeout: options.timeout,
ignoreInvalidUrls: options.ignoreInvalidUrls,
highlights: options.highlights,
scrape: options.scrape,
scrapeFormats,
onlyMainContent: options.onlyMainContent,
Expand Down
2 changes: 2 additions & 0 deletions src/types/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export interface SearchOptions {
timeout?: number;
/** Exclude URLs invalid for other Firecrawl endpoints */
ignoreInvalidUrls?: boolean;
/** Return query-relevant highlights instead of the original search snippets */
highlights?: boolean;
/** Output file path */
output?: string;
/** Output as JSON format */
Expand Down
Loading