Limiting search results to a specific document per user when querying vectorized text documents

I have a use case where I have 1000 .doc files, each containing 400-1200 lines of text. I vectorized each line of text and stored the embeddings in Weaviate. This allows me to search across the entire corpus of documents.

However, each user should only be able to search within their specific document, not across all documents. For example, if User A uploads Document A, they should only get search results from the vectorized lines in Document A.

I tried splitting each document into individual lines before vectorizing and storing in Weaviate. But when users search, their query still goes across the entire corpus instead of being limited to their document.

Is there a way in Weaviate to associate vectors or documents to specific users, so that search results can be scoped to just the lines from their document? I’m looking for a solution that doesn’t involve completely separating each user’s vectors into different databases or schemas.

Any suggestions on the best approach to limit search scope per user/document would be appreciated!

I think what you can do is include a user id and then when you commit a search to user the “where” part of the graphql to limit it to the user id you added…

where_filter = {
    "path": ["userId"],
    "operator": "Equal",
    "valueText": "a129-1231...",
}

result = (
    client.query
    .get("Question", ["question", "answer", "category"])
    .with_near_text({"concepts": ["biology"]})
    .with_where(where_filter)
    .do()
)