constmetadata1 = { restricts: [{ namespace:"colour", allowList: ["green", "blue, "purple"], denyList: ["red", "grey"], }], numericRestricts: [ { namespace:"price", valueFloat:4199.99, }, { namespace:"weight", valueDouble:987.6543, }, { namespace:"ports", valueInt:3, }, ], } constproductDescription1 = "The 'Synapse Slate' seamlessly integrates neural pathways, allowing users to control applications with thought alone. Its holographic display adapts to any environment, projecting interactive interfaces onto any surface." constdoc1 = Document.fromText(productDescription1, metadata1);
// Index the document along with its restricts and numericRestricts constindexResponse = awaitai.index({ indexer:vertexAiIndexerRef({ ... }), [doc1], });
// Later, construct a query using restricts and numeric restricts const queryMetadata = { restricts: [{ namespace:"colour", allowList: ["purple"], denyList: ["red"], }], numericRestricts: [{ namespace:"price", valueFloat:5000.00, op:LESS, }] }; constquery = "I'm looking for something with a projected display"; constqueryDoc = newDocument(query, queryMetadata);
VertexAI vector search plugin