@Override
    public void addOrUpdate(Iterable<HaloDocument> haloDocs) {
        var docs = new LinkedList<Document>();
        var terms = new LinkedList<BytesRef>();
        haloDocs.forEach(haloDoc -> {
            var doc = this.haloDocumentConverter.convert(haloDoc);
            terms.add(new BytesRef(haloDoc.getId()));
            docs.add(doc);
        });
        var deleteQuery = new TermInSetQuery("id", terms);
        try {
            this.indexWriter.updateDocuments(deleteQuery, docs);
            this.searcherManager.maybeRefreshBlocking();
            this.indexWriter.commit();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
@Test
    void shouldAddOrUpdateDocument() throws IOException {
        var haloDoc = createFakeHaloDoc();
        searchEngine.addOrUpdate(List.of(haloDoc));
        verify(this.indexWriter).updateDocuments(any(Query.class), assertArg(docs -> {
            var docList = Streams.stream(docs).toList();
            assertEquals(1, docList.size());
            var doc = docList.get(0);
            assertInstanceOf(Document.class, doc);
            var document = (Document) doc;
            assertEquals("fake-id", document.get("id"));
        }));
        verify(this.searcherManager).maybeRefreshBlocking();
        verify(this.indexWriter).commit();
    }