Skip to content
gsearch

Storing results

Save results into DuckDB with --save, see a feature breakdown with info, reprint with dump, and re-export with export.

The file export keeps a copy of each run, but for filtering and aggregation gsearch can also persist results into a DuckDB database. --save writes there, and info, dump, and export read back.

Saving with --save

Add --save to any search to upsert the result into DuckDB alongside the normal output:

gsearch search "real madrid" --save
gsearch search "weather tokyo" --save

The store is keyed by query, so re-running a saved query updates its row rather than duplicating it. Each row keeps the full result blobs plus boolean flags for each feature kind, which is what makes the breakdown and filtering fast.

The database path

By default the database lives at ~/data/gsearch/gsearch.duckdb. Point it elsewhere with --db or the GSEARCH_DB environment variable:

gsearch search "epl" --save --db /tmp/serps.duckdb
GSEARCH_DB=/tmp/serps.duckdb gsearch info

The --db flag and GSEARCH_DB work on every database command, so set the variable once in a shell and search --save, info, dump, and export all use it.

info: the feature breakdown

gsearch info prints how many searches are stored and, across all of them, how often each feature kind appeared:

gsearch info
DB: ~/data/gsearch/gsearch.duckdb
Searches stored: 12

  Feature            Count   %
  Knowledge Panel    7       58%
  Organic Results    12      100%
  Weather            3       25%
  Sports Standings   2       17%
  Stock              2       17%

This is the quick way to see what kinds of pages you have collected.

dump: reprint recent searches

gsearch dump reprints the most recent stored searches using the same renderer as search. -n (or --limit) sets how many, default 10:

gsearch dump -n 5            # the five most recent, rendered
gsearch dump -n 5 --json     # the same, as JSON

--json prints the stored results as a JSON array instead of the rendered summary.

export: rewrite to files

gsearch export re-runs the file exporter over recent stored results, writing fresh JSON and Markdown under ~/data/gsearch. This is how you regenerate the exported files, for instance after clearing the export tree or to bulk-produce Markdown from a session's worth of saved searches:

gsearch export -n 20         # rewrite the latest 20 to json + markdown
  ✓ ~/data/gsearch/markdown/2026/06/13/22-41-real-madrid.md
  ✓ ~/data/gsearch/markdown/2026/06/13/22-39-weather-tokyo.md
  ...

Like dump, -n sets the count.

A typical session

gsearch search "real madrid" --save
gsearch search "weather tokyo" --save
gsearch search "AAPL stock" --save
gsearch info                 # what did I collect?
gsearch dump -n 3            # reread the last three
gsearch export -n 3          # rewrite them to markdown