Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:FlowiseAI Flowise QueryVectorStore

From Leeroopedia
Attribute Value
Sources packages/ui/src/api/documentstore.js:L29
Domains Document_Store_Ingestion
Last Updated 2026-02-12 14:00 GMT

Overview

QueryVectorStore is the API client function that sends a natural language query to the server for embedding and similarity search against a document store's configured vector store. It returns matching document chunks along with timing metrics for retrieval performance assessment.

Code Reference

Source Location

Signature

const queryVectorStore = (body) => client.post(`/document-store/vectorstore/query`, body)

This function sends a POST request to the /api/v1/document-store/vectorstore/query endpoint via the configured axios client instance.

Import

import documentStoreApi from '@/api/documentstore'

The function is accessed as documentStoreApi.queryVectorStore(body) after importing the default export from the documentstore API module.

I/O Contract

Inputs

Parameter Type Required Description
body object Yes The query configuration
body.query string Yes The natural language query text to search for
body.storeId string Yes The document store identifier to search within
body.inputs object Yes Vector store query configuration
body.inputs.topK number No Maximum number of results to return (default varies by provider)
body.inputs.searchType string No Search algorithm: "similarity" or "mmr" (Maximal Marginal Relevance)
body.inputs.filters object No Metadata filters to constrain search results

Outputs

Field Type Description
data object The query result object
data.docs Document[] Array of matching document chunks, ordered by relevance
data.docs[].pageContent string The text content of the matching chunk
data.docs[].metadata object Metadata associated with the chunk (source, page, etc.)
data.timeTaken number Time in milliseconds for the query execution

The function returns a Promise<{data: {docs: Document[], timeTaken: number}}> from the axios response.

Usage Examples

Basic Similarity Search

import documentStoreApi from '@/api/documentstore'

const searchDocuments = async (storeId, queryText) => {
    const body = {
        storeId,
        query: queryText,
        inputs: {
            topK: 5,
            searchType: 'similarity'
        }
    }

    const response = await documentStoreApi.queryVectorStore(body)
    const { docs, timeTaken } = response.data

    console.log(`Found ${docs.length} results in ${timeTaken}ms`)
    docs.forEach((doc, i) => {
        console.log(`\n--- Result ${i + 1} ---`)
        console.log(`Content: ${doc.pageContent.substring(0, 200)}...`)
        console.log(`Source: ${doc.metadata.source || 'unknown'}`)
    })

    return response.data
}

MMR Search for Diverse Results

import documentStoreApi from '@/api/documentstore'

const diverseSearch = async (storeId, queryText) => {
    const body = {
        storeId,
        query: queryText,
        inputs: {
            topK: 8,
            searchType: 'mmr'  // Maximal Marginal Relevance for diverse results
        }
    }

    const response = await documentStoreApi.queryVectorStore(body)
    console.log(`MMR search: ${response.data.docs.length} diverse results in ${response.data.timeTaken}ms`)
    return response.data
}

Query with Metadata Filters

import documentStoreApi from '@/api/documentstore'

const filteredSearch = async (storeId, queryText, sourceFilter) => {
    const body = {
        storeId,
        query: queryText,
        inputs: {
            topK: 5,
            searchType: 'similarity',
            filters: {
                source: sourceFilter  // Only search chunks from a specific source
            }
        }
    }

    const response = await documentStoreApi.queryVectorStore(body)
    return response.data
}

Retrieval Quality Testing

import documentStoreApi from '@/api/documentstore'

const testRetrievalQuality = async (storeId, testQueries) => {
    const results = []

    for (const testQuery of testQueries) {
        const body = {
            storeId,
            query: testQuery.question,
            inputs: { topK: 5, searchType: 'similarity' }
        }

        const response = await documentStoreApi.queryVectorStore(body)
        const { docs, timeTaken } = response.data

        // Check if expected content appears in results
        const foundExpected = docs.some(doc =>
            doc.pageContent.includes(testQuery.expectedSnippet)
        )

        results.push({
            question: testQuery.question,
            resultCount: docs.length,
            timeTaken,
            foundExpected,
            topResult: docs[0]?.pageContent.substring(0, 100)
        })

        console.log(`"${testQuery.question}" => ${foundExpected ? 'PASS' : 'FAIL'} (${timeTaken}ms)`)
    }

    return results
}

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment