Sync

Compare your folders with the phone's copy of the index, on the phone, then act on the difference.

A sync keeps your index in step with the photos on your phone. There is one way it works, whatever started it: compare your folders with the phone's copy of the index, on the phone, then act on the difference.

EVERY SYNC, WHATEVER STARTED IT 01 The index is thereOne call reads your indexes, the index address and your plan. A missing index is created,only when the list of your indexes says for certain that it is not there. 02 Scan your foldersThrough MediaStore. Every photo gets its id: md5 of its path inside the phone's storage. 03 Compare on the phoneYour folders against the phone's own copy of the index. No request is made, nothing isdownloaded: both sides are already on the phone. 04 Delete what left the phoneFrom the index and from the phone's copy, 500 ids per request. 05 Send what is new or changedFive photos per photos_ingest call. Opensolr reads them and writes the documents, whichare searchable about ten seconds later. 06 Carry up your wordsTags, people, wording and places: fifty photos per photos_words call, no picture. Only one sync runs at a time. A button that touches the index stops the running sync first,does its own work, then starts the sync again.
EVERY SYNC, WHATEVERSTARTED IT 01 The index is thereOne call reads yourindexes, the indexaddress and your plan.A missing index is created. 02 Scan your foldersEvery photo gets its id:md5 of its path insidethe phone's storage. 03 Compare on the phoneYour folders against thephone's own copy of theindex. No request. 04 Delete what leftFrom the index and thecopy, 500 ids per request. 05 Send what is newFive photos perphotos_ingest call.Opensolr reads them andwrites the documents. 06 Carry up your wordsTags, people, wording andplaces: fifty photos perphotos_words call, nopicture attached. Only one sync runs at atime. A button thattouches the index stopsthe running sync first.

Figure 1 — the steps of every sync. The comparison happens on the phone; only the deletes, the photos to read and the words to carry up leave it.

01 · What is sent, and what is not
  • A new photo is sent to be read: five photos per photos_ingest call, with an upright 1024 px copy. On a plan without vector search nothing is read; the photo is written with what the phone knows.
  • A changed file is checked first. If the picture itself is the same (the same md5, or the same picture fingerprint), only its facts are updated and nothing is read again. If the picture changed, it is read again from scratch.
  • A moved or renamed photo gets a new id, since its id is its path. When it is the same file, your tags, people, wording and place move with it.
  • Your words — tags, people, wording, a place you set — go up through photos_words, fifty photos per call, with no picture.
  • A photo gone from the phone is deleted from the index and from the copy, 500 per request.
  • Also read again: photos you asked to Re-sync, everything after Re-read, and photos indexed without words once the AI allowance is back.

Every write is searchable about ten seconds later. At the end, the app commits, stores what was written in its copy, and reads the plan usage again.

ON THE PHONEa1f3… IMG_0001.jpgb72c… IMG_0002.jpgc9d0… IMG_0003.jpge41b… IMG_0005.jpgfresh scan of your folders THE PHONE'S COPYa1f3…b72c…d5e6…of the index, on the phone:no request THE SYNC DOESa1f3…keepb72c…keepc9d0…adde41b…addd5e6…delete id = md5 of the photo's path inside the phone's storage, made by one function everywhere.A file whose picture changed is read again. A new index has an empty copy, soeverything is added.
ON THE PHONEa1f3… IMG_0001.jpgb72c… IMG_0002.jpgc9d0… IMG_0003.jpge41b… IMG_0005.jpgfresh scan of your folders THE PHONE'S COPYa1f3…b72c…d5e6…of the index: no request THE SYNC DOESa1f3…keepb72c…keepc9d0…adde41b…addd5e6…delete id = md5 of the photo'spath inside the phone'sstorage, made by onefunction everywhere.A file whose picturechanged is read again.A new index has an emptycopy: everything is added.

Figure 2 — the comparison, both sides on the phone: keep what is in both, add what is only in the folders, delete what is only in the copy.

02 · The pages of this part

Opensolr Photos is open source and MIT licensed. Questions about your Opensolr account, index or plan go to opensolr.com/contact; questions about the app itself belong on GitHub.

Opensolr Photos Documentation