Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

feat(store): make the fixed result cap of 20 configurable

Open Beginner friendly
#863 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
80/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
go, sqlite
Domain
databases

Research direction

Start in internal/store/store.go: MaxSearchResults is set at :504, hardcoded to 20 in DefaultConfig (:517) and FallbackConfig (:530), and enforced as a clamp in SearchContext (:3530). Read how ENGRAM_MAX_SEARCH_RESULTS-style env vars are parsed elsewhere (e.g. ENGRAM_PORT in cmd/engram/main.go:728) for the invalid-value fallback pattern. Done means ENGRAM_MAX_SEARCH_RESULTS=100 lets search --limit 100 return up to 100 rows, and with the variable unset behavior stays identical at cap 20.

Written by the indexing model from the issue text.

Description

priority:medium status:needs-review type:feature
📋 Pre-flight Checks
  • I have searched existing issues and this is not a duplicate
  • I understand this issue needs status:approved before a PR can be opened
🔍 Problem Description

The search cap cannot be changed from outside the binary. On 975490b MaxSearchResults is a Config field (internal/store/store.go:504) whose only two constructors both hardcode 20 (:517 in DefaultConfig, :530 in FallbackConfig), and SearchContext clamps every request to it (:3530). No env var, flag or config file reaches it, and search has no offset or paging, so rows past the cap cannot be reached through search.

Measured on 2026-08-24 against a pristine build of 47f281c over a 31k-observation store: 3,242 live observations match docker, and engram search "docker" --limit 100 returns 20 rows. --limit 100 is accepted and the result set is still 20. The cap and the clamp are unchanged on 975490b.

💡 Proposed Solution

ENGRAM_MAX_SEARCH_RESULTS overrides the cap; unset keeps 20.

Invalid values fall back to the default silently, which is how the three non-test Go reads of ENGRAM_PORT behave today (cmd/engram/main.go:728, internal/cloud/config.go:59, cmd/engram/cloud_daemon_probe.go:72, all on 975490b). Happy to log or error instead if you prefer.

Example:

ENGRAM_MAX_SEARCH_RESULTS=100 engram search "docker" --limit 100

One acceptance target: with ENGRAM_MAX_SEARCH_RESULTS=100, search --limit 100 can return up to 100 rows. Unset, behavior stays byte-identical (cap 20).

📦 Affected Area

Store (database, queries)

🔄 Alternatives Considered

Adding --offset or paging to engram search. That is a larger surface and changes the CLI contract; a single cap override covers the need without touching the query path.

Raising the hardcoded number. That would still be a single number for every store.

Reading rows through GET /observations?limit=N, which can return more than 20. That returns recent rows, not ranked matches, so it does not answer a search.

📎 Additional Context

I found no existing issue covering the search cap, open or closed.

Working implementation running in a production fork. Happy to submit it as a focused PR if this gets status:approved.

Split out of #752, where the maintainer asked for focused proposals with one acceptance target each. This supersedes #761, which I filed through the API and therefore without this form's labels.

Dominant language
Go
Stars
7.1k
Forks
729
Avg merge
8h 48m
Merged PRs (30d)
340

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Gentleman-Programming/engram

All issues in Gentleman-Programming/engram

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.