anush008 opened a new pull request, #3674:
URL: https://github.com/apache/tika/pull/3674

   ## Description
   
   This PR adds a Qdrant emitter to Tika Pipes. It writes the vectors in 
`tk:chunks` to a Qdrant collection as points.
   
   [Qdrant](https://qdrant.tech/) is an open-source vector search engine built 
for high-performance and massive scale.
   
   JIRA: TODO (My request for an account at 
[selfserve.apache.org](https://selfserve.apache.org/jira-account.html) didn't 
go through).
   
   The new `tika-pipes-qdrant` plugin calls the Qdrant REST API with Apache 
HttpClient, like the ES and OpenSearch emitters. It adds no new third-party 
dependencies.
   
   - Each unit of `tk:chunks` becomes one point. Chunks that share a 
`correlator`, such as the sound and picture of one video segment, become one 
point.
   - Each `producer` (inference binding) becomes a named vector on the point.
   - Point IDs are UUIDs made from the emit key, the file position, and the 
unit position. A re-emit overwrites the same points.
   - After the upserts, the emitter deletes the container's points that the new 
parse no longer produces (`replaceExisting`, default `true`).
   - The payload holds `container_id`, the chunk text, the locators (page, 
offsets, times), and the file's metadata (`metadataFields`).
   
   ### Testing
   
   - Unit tests for the chunk-to-point mapping, the HTTP requests, and the 
config checks.
   - Testcontainers integration tests that load the plugin zip and write to 
Qdrant 1.20.2.
   - `./mvnw clean install` passes on the full build.
   - I've also tested end to end against local Qdrant with a local stand-in for 
the embedding model. The runs covered PDFs, Office files, emails with 
attachments, video, and audio. They also covered re-runs, Qdrant outages, API 
keys, and HTTPS.
   
   ### Setup
   
   You can run Qdrant with
   
   ```bash
   docker run -p 6333:6333 -p qdrant/qdrant
   ```
   
   The dashboard is accessible at http://localhost:6333/dashboard.
   
   The emitter uses the REST API at port `6333` 
([Ref](https://qdrant.tech/documentation/interfaces/)).
   
   Create a collection with one named vector per inference binding:
   
   ```bash
   curl -X PUT http://localhost:6333/collections/tika-chunks \
     -H 'Content-Type: application/json' \
     -d '{"vectors": {"text-vectors": {"size": 1024, "distance": "Cosine"}}}'
   ```
   
   Then add the emitter to the pipes config:
   
   ```json
   "emitters": {
     "qdrant": {
       "qdrant-emitter": {
         "qdrantUrl": "http://localhost:6333";,
         "collection": "tika-chunks"
       }
     }
   }
   ```
   
   Set `"emitStrategy": {"type": "EMIT_ALL"}` under `pipes`, so the report 
lists each file that Qdrant rejects. The docs page is 
`docs/modules/ROOT/pages/pipes/plugins/qdrant.adoc`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to