A Python application needs to query a Databricks Vector Search index on a standard endpoint using its SDK. The application must retrieve a maximum of five relevant items. A critical condition is that the retrieved items must also have their 'status' field equal to 'approved'. Which SDK method call correctly achieves these requirements?
Answer & explanation
Correct answer: B
WHY B is correct: The Databricks Vector Search Python SDK's similarity_search() method accepts num_results for the result count limit and a filters parameter that takes a dictionary of column-value pairs for metadata filtering. {'status': 'approved'} restricts results to documents whose 'status' column equals 'approved'.
WHY NOT A: This call is missing the status filter. It will return the top-5 most similar documents regardless of their status column value, potentially returning non-approved documents.
WHY NOT C: where_clause is not a parameter in the Databricks Vector Search SDK's similarity_search() method. Filters are always passed through filters: a dictionary on standard endpoints, or a SQL-like filter string on storage-optimized endpoints.
WHY NOT D: top_k and metadata_filter are not the correct parameter names in the Databricks Vector Search SDK. The correct parameters are num_results and filters respectively. Calling the method with these names fails with an unexpected-keyword error.