Rebuild Index
Convert your index's engine without re-embedding everything
- index
- index
- status
The pack's index nodes give you three FAISS engine options - Flat, IVF-Flat, and HNSW - but the one you pick at creation time isn't a life sentence. Rebuild Index rewrites an existing index's FAISS file into a different index type, and the reason this matters is that it does so without re-running your embedding model over the library. No re-encoding ten thousand photos; it just re-arranges the vectors you already have into the new index structure.
The mechanism is the trick FAISS indexes allow: the vectors themselves don't change, only the organization of them. A Flat index is an unsorted list - exact, simple, slow at scale. Rebuilding it as HNSW builds the navigable graph on top of the same vectors; rebuilding as IVF-Flat trains the cluster centroids (which is why that one needs a large enough library to make clusters meaningful). Either way, the pack reuses the stored vectors, so the rebuild is a matter of seconds to a few minutes rather than the hours a fresh indexing pass would cost. It also quietly compacts as it goes - dead vectors from removals are dropped in the rebuild - so a rebuild doubles as a deep-clean.
Inputs and outputs
Required: index. Optional: new_index_type, default Keep Current - the tooltip spells out the two behaviors: pick a new type to convert, or keep current to "compact without changing type." Options are Keep Current, Flat (Exact), IVF-Flat (Fast), HNSW (Very Fast). Outputs: the same SEMANTIC_INDEX plus a status STRING that reports the conversion, e.g. Rebuilt index: flat → hnsw (12847 vectors), or Compacted index: 12847 → 11000 vectors if you kept the type.
Install
Same as every node in this pack - ComfyUI Manager (search "Semantic-Search") or
cd ComfyUI/custom_nodes
git clone https://github.com/EricRollei/Semantic-Search
pip install faiss-cpu "qwen-vl-utils>=0.0.8" transformers accelerate pillow
restart, and you'll find it under Eric/SemanticSearch.
Where people get burned
- IVF needs a real library. Training clusters on a handful of vectors produces garbage clusters, and the pack's own guidance puts IVF's comfort zone at 50K–500K images. If your library is a few thousand files, converting to IVF is a downgrade - HNSW is the no-training-required speed option for mid-size libraries (10K–1M per the README).
- Approximate ≠ broken. After converting to IVF or HNSW you're trading ~100% recall for ~95–99% plus speed. Results get slightly fuzzier on edge cases, which is the deal you signed up for. If you notice it, the fix is going back to Flat, not blaming the search.
- You don't actually have to pick. "Keep Current" as a rebuild is just a compact - if that's all you wanted, Compact Index is the same thing with a clearer name. Use the explicit type only when you're genuinely switching engines.
Rebuild Index is the upgrade path that keeps the pack's central promise intact: index once, and you can keep rearranging the furniture in your search library without ever touching the embeddings again.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| index | SEMANTIC_INDEX | — | |
| new_index_typeopt | COMBO | Keep Current | New index type. 'Keep Current' will compact without changing type. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| index | SEMANTIC_INDEX | — |
| status | STRING | — |