npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@gozio/gosearch-ingest

v0.0.3

Published

Node.js ingest pipeline: converts location/category JSON into gosearch SQLite FTS5 database

Readme

gosearch-ingest

Node.js ingest pipeline for the Gozio FTS5-based location search engine. Published as the @gozio/gosearch-ingest npm package.

What's here

src/
  db.js                AUTOGENERATED — schema SQL, initDb(), and shared constants
                         (source of truth: shared/schema/constants.json + fts5.json)
  normalize.js         Text and tag normalization (shared by ingest modules)
  category_ingest.js   Ingest categories JSON → categories / category_tags tables
  location_ingest.js   Ingest places JSON    → locations / location_tags /
                                               locations_fts / location_curated_lists

bin/
  seed-db.js           CLI: generate a gosearch SQLite database from JSON files

index.js               Library entry point — exports ingestToSqlite()

data/                  Generated at runtime — not committed

Design overview

See SEARCH_STRATEGY.md for the full schema rationale, FTS5 column weights, query patterns, and ingest decisions. Key points:

  • FTS5 + BM25 replaces the old C++ bigram/dice-coefficient engine.
  • Tags are bucketed into three FTS columns (tags_high / tags_normal / tags_low) so per-tag weights survive into BM25 scoring.
  • Short name tokens (< 5 codepoints) get a synthetic tags_high entry so exact-name locations outscore longer prefix matches for short queries like "lab" or "ent".
  • Lowercasing and diacritic stripping are handled by SQLite's unicode61 remove_diacritics 2 tokenizer at both index and query time — no application-layer normalization needed.

Requirements

  • Node.js >= 22 (uses the built-in node:sqlite module)

Using the library

const { DatabaseSync } = require('node:sqlite');
const { initDb } = require('@gozio/gosearch-ingest/src/db');
const { ingestCategories } = require('@gozio/gosearch-ingest/src/category_ingest');
const { ingestLocations } = require('@gozio/gosearch-ingest/src/location_ingest');

const db = new DatabaseSync(outPath);
initDb(db, locale);
ingestCategories(db, categories, locale);  // categories — array of category objects
ingestLocations(db, networkId, locations, locale);  // locations — array of location objects
db.close();
  • categories / locations — plain JS arrays (parsed from JSON)
  • locale — e.g. 'en', 'es'
  • outPath — path where the SQLite file will be written

For a single-command CLI wrapper, see bin/seed-db.js below.

CLI: seed-db

Generate a database from JSON files:

# Production format
node bin/seed-db.js \
  --db <path> \
  --locale <locale> \
  --network <network-id> \
  --categories <categories.json> \
  --locations <locations.json>

# Fixture format (gosearch test suite)
node bin/seed-db.js \
  --db <path> \
  --fixture <fixtures.json>

The --fixture format expects the gosearch test data schema: { categories: [...], locations: [...], curated_lists: [...] } and applies post-ingest fixups: curated list insertion.