Nodes/Eric/Load/Create Index
ComfyUI Node

Load/Create Index

Your searchable photo library lives in an index — this node opens it

By EricRollei·Created 7 months ago·Updated 7 months ago· 2
Load/Create Index
    • index
    index_namedefault
    embedding_dim4096
    index_typeFlat (Exact)

    Before this pack can find anything, your library has to be an index - a persistent store that keeps a vector embedding plus a thumbnail for every image you've pointed at it. Load/Create Index is the node that opens that store: give it a name, and it either loads the matching index from disk or builds a fresh empty one. Once it exists, it survives ComfyUI restarts, which is the whole point - you index 30,000 photos once, then every future session just loads the index and searches instantly.

    The name is doing real work here. "Load" and "create" are the same node because the store is just a directory on disk. Internally each index is a config.json (index type, dimension), a FAISS vectors.faiss file, a SQLite metadata.db, and a thumbnails/ folder - all living under the pack's configured INDEXES_PATH in core/config.py. Point the same index_name at it again tomorrow and you get the same index back, embeddings and all.

    The three inputs that matter

    • index_name - the store's name, default "default". Use descriptive names per library ("portraits", "product_shots"); that's what the multi-index search node keys off.
    • embedding_dim - must match the dimension your embedding model outputs: 4096 for the 8B model, 2048 for the 2B, or the reduced Matryoshka dim you picked in Load Embedding Model. This is the pack's most common beginner trap: mismatch the dims and every search/indexing node bails with a dimension error.
    • index_type - only applies to new indexes (the tooltip is explicit). Your three FAISS options:
      • Flat (Exact) - brute-force, 100% recall, the right default under ~10–50K images.
      • IVF-Flat (Fast) - clustering-based, ~6x faster search at 95–99% recall, but needs training on 1000+ vectors first.
      • HNSW (Very Fast) - graph-based, the speed king, no training required, ~95–99% recall.

    For a home photo library, Flat is honestly fine until it isn't; switch to HNSW when searches start feeling sluggish.

    Output

    One output: a SEMANTIC_INDEX handle. It feeds every indexing node (Add/Remove Folder, Get Index Info) and every search node (Search by Text, Image, Video, Document). Nothing else will work until this node has run once.

    Install

    Same pack install as the rest - ComfyUI Manager (search "Semantic-Search", pack title "Eric") 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
    

    then restart ComfyUI. Nodes appear under Eric/SemanticSearch.

    Where people get burned

    • Dimension mismatch errors everywhere - your index and model disagree. Easiest fix: delete the index (or use a new index_name) and create it with the dim matching your model.
    • Indexes "vanishing" between sessions - the index isn't gone; it's stored wherever INDEXES_PATH points, which by default is H:/semantic_search/indexes (a Windows-style path baked into config.py). On a machine without an H: drive it just creates a literal H: folder in your working directory. If you move the pack between machines, check core/config.py and repoint INDEXES_PATH/MODELS_PATH to something sensible, or your library quietly "disappears."
    • IVF index erroring on tiny libraries - IVF needs enough vectors to cluster (roughly 1000+). On small folders, stay on Flat or use HNSW.
    CategoryEric/SemanticSearch

    Inputs (3)

    NameTypeDefaultDescription
    index_nameSTRINGdefault
    embedding_dimoptINT4096512–8192Embedding dimension (4096 for 8B model, 2048 for 2B model)
    index_typeoptCOMBOFlat (Exact)FAISS index type. Flat=exact, IVF-Flat=fast approximate, HNSW=very fast approximate. Only applies to new indexes.

    Outputs (1)

    NameTypeDescription
    indexSEMANTIC_INDEX