github tobiaswuerth/sift v2.2.0

one hour ago

Keyword searches of many words several times faster, and searches beside indexing and embedding: sift serve reads
only the codes added since its last search and lets searches go between an embed's batches, sift index keeps its
readers busy beside slow and hung files, web pages in other encodings than UTF-8 keep their letters, and sift serve
and sift worker stay up under many idle connections. The store layout is that of 2.0, so stores need no upgrade;
start sift serve again after upgrading.

Security

  • The MCP tool collections, asked for unresolved links, listed those of collections kept from agents
    (sift add --no-agents), with the ids of the notes that hold them. It now lists those of the collections agents
    may see, and refuses to name the others, as every other tool does.
  • sift serve and sift worker no longer end on Windows when many idle connections are open: asyncio's selector
    there watches at most 512 sockets, and about 512 idle connections, which need no token, ended either server. Both
    now keep at most 384 connections open and close those past them at once. The worker closes a connection that has
    not finished TLS within 5 seconds (asyncio waited 60), refuses a request without its token on every path and closes
    the connection after the refusal, and gives up on a close the other machine does not answer after 5 seconds
    (asyncio waited 30); sift serve also closes a connection whose command it refuses for want of the token. A
    connection without the token thus holds a place in the worker for at most about 20 seconds. This does not stop a
    flood: from about 5 such connections a second the worker answers some requests that it is busy, and from about 7
    every one. Let only your own network reach the worker. On Linux and macOS, sift worker raises its soft limit of
    open files as sift serve does.

Added

  • A hybrid page that reaches past the candidates says that it is ranked anew among more and may repeat or skip
    results of the pages before, and how to page consistently: in a note on the command line and in the answer of the
    MCP tool search, and as ranked_anew in the JSON answer.

Fixed

  • A fault of sift itself in keyword search was reported as a damaged keyword index, with the advice to remove the
    collection and index it again. Only a damaged index is reported so now; a fault of sift is an internal error to
    report.
  • For a keyword that starts with -, the advice was to write NOT word, which sift then refused when no word stood
    before NOT. It now gives a query sift reads that leaves the word out, such as contract NOT word, wherever sift
    can leave it out. The keyword syntax in the usage guide also says that words side by side bind closer than NOT:
    a NOT b c leaves out what holds both b and c.
  • sift import run again over a home of sift 1.x that names its stores by another path to them (through a
    symbolic link, a junction, a mapped drive or a short name) refused each collection as one of that name that was
    not imported from there. It now goes on where it stopped.
  • sift move to a place where a log, shared memory or journal of SQLite already lay (NAME.sqlite-wal, -shm,
    -journal), left, say, by a database whose main file alone was deleted, said moved, and SQLite then read that
    file into the moved store: its documents were lost. A move now refuses such a place before anything moves, naming
    the file, as it refuses a place where a store lies.
  • A very long query, or a passage with long front-matter values, stalled a search or a sift worker for seconds
    while the reranker read it, and every other search of the process with it. The query and each passage now reach
    the reranker cut to 8 characters per token it reads (8,192 for 1,024 tokens), which leaves what it reads of prose
    as it was.
  • In sift serve, a search waited while an embed ran: for a whole call of 1,024 passages (about 2 s on a GPU, and
    minutes on the CPU), and for 20 to 60 s while the model compiled. Its question and its reranking now go between
    the embed's batches, and while the model compiles, searches run it as it is.
  • Web pages (.html, .htm) saved in Windows-1252, Latin-1 or another encoding than UTF-8 keep their accented
    letters ("Müller" no longer becomes "M�ller"), and pages saved as UTF-16 with a byte order mark are read instead of
    turning into garbage. A page is read by its byte order mark, else as UTF-8 where its bytes are UTF-8, else in the
    encoding its <meta charset> or <meta http-equiv="Content-Type"> names in its first 1,024 bytes, as browsers do,
    else as any text file. An attached web page goes by the charset its part of the mail names before its meta, unless
    the part names UTF-8 or US-ASCII, as many mailers name every part. An attached web page or text file in UTF-16
    without a byte order mark, its part naming UTF-16, is read in UTF-16 rather than as UTF-8 full of NULs. Pages and
    mails indexed before are read again once they change: touch them, or remove the collection and add it again.
  • A mail whose part names a charset holding a NUL character, as charset="utf-8\0" does, was reported unreadable,
    its body and attachments with it. Such a name now says nothing, and the mail is read.
  • The text of a mail part named UTF-8 that starts with a byte order mark no longer starts with that mark.
  • The help and the guides said that a hybrid search takes k candidates of each kind when k is larger than
    --candidates, and that pages follow each other. A page whose offset plus k reaches the candidates in fact takes
    one more than that, reranked anew, so it may repeat or skip hits of the pages before; they now say so, and that
    --candidates above the deepest offset plus k pages consistently.

Changed

  • The command line asks for a home process of sift 2.1.0 or older to be started again with this sift, as such a
    process cannot say when a hybrid page is ranked anew. Older command lines go on working with a newer home process.
  • sift index keeps its reader processes busy. They read documents a batch at a time, so each batch waited for its
    slowest file. The readers now take the next file as they finish, holding at most 64 MB of files at a time; smaller
    files pass one that waits for room, which starts as soon as the files before it end, and a document over 64 MB is
    still read alone, the other readers waiting. What they read is written as it comes, the notes first, so a hung
    document no longer holds back the notes, the documents read beside it or the progress shown. On a Windows desktop
    with 32 CPU threads and 30 readers, 3,000 notes and 40 documents of which one hangs past its limit of 30 s are kept
    but that one in 13 to 19 s instead of 51 to 56 s, 40 documents of half a second take 3.0 s instead of 3.8 s, and 40
    of 33 MiB take 20.5 s, as before.
  • sift index reads files in pieces of 64 KiB instead of 1 MiB. On Windows, indexing many small notes takes about
    half as long (20,000 notes of 1.4 KB: 24 s before, 12 to 14 s now); large files read as fast as before.
  • A semantic or hybrid search whose nearest passages fall in few documents, as in collections of long PDFs or books,
    no longer counts every embedded document of the collections searched, which took about half a second a search
    over 5 million passages.
  • A keyword search of many words, such as a long OR or a question pasted without operators, held a score for every
    word and passage of each batch it scored. It now keeps of each word only the passages within reach of the results:
    over a synthetic store of a million passages on a desktop with 32 CPU threads, an OR of 1,000 common words took
    about 30 s and 5 GB and now takes 3 s and 1 GB, and a 200-word question took 6 s and 1.3 GB and now 1.5 s and
    0.7 GB, with the same hits.
  • sift serve no longer reads every code of a collection again after each batch of sift embed or each index that
    adds vectors, about 30 s at 30 million passages: a search reads only the codes of passages embedded since, and at
    most five held codes for each passage that waited below them. While those are joined into parts of at most 64 MiB, a
    collection's codes take at most 64 MiB more, plus 25 bytes for each passage joined, and the codes kept for searches
    on the snapshot just before the newest at most that much again. Every code is read again once a vector is replaced
    or removed, once another file lies at the store's path, or once a search finds counts of the store's vectors
    (changes, vectors written, vectors stored) that adding vectors to the codes held cannot give. A copy put over the
    store in place with the counts held, or those plus vectors added, is taken for the store, so its searches may miss
    passages, until one of those happens or the home process starts again.

Don't miss a new sift release

NewReleases is sending notifications on new releases.