> ## Documentation Index
> Fetch the complete documentation index at: https://docs.langdock.com/llms.txt
> Use this file to discover all available pages before exploring further.

# File Search

> Search and retrieve information from your folders to enrich workflows with organizational knowledge.

<img src="https://mintcdn.com/langdock-34/7T5PxfiNlawrX7FY/images/workflows/screenshots/FileSearchNode.png?fit=max&auto=format&n=7T5PxfiNlawrX7FY&q=85&s=38ef23784b7dbddf536319119b7686ef" alt="File Search Configuration" width="3840" height="2160" data-path="images/workflows/screenshots/FileSearchNode.png" />

<Info>
  **Knowledge Folders are now called Folders.** Find them in the [Library → Folders](/en/using-langdock/library/folders).
</Info>

## Overview

The File Search node queries your folders to retrieve relevant information and context. Connect your workflow to your organization's knowledge base - search through documents, files, and data stored in folders to enrich AI responses, validate information, or provide context for decisions.

<Info>
  **Best for**: Knowledge retrieval, document search, context enrichment, RAG
  (Retrieval Augmented Generation), and accessing organizational knowledge.
</Info>

## When to Use File Search

**Perfect for:**

* Searching company documentation and knowledge bases
* Retrieving relevant context for AI agent responses
* Finding specific information across multiple documents
* Implementing RAG (Retrieval Augmented Generation) patterns
* Validating information against internal knowledge
* Enriching workflows with organizational data

**Not ideal for:**

* Real-time web search (use Web Search node)
* Fetching data from external APIs (use HTTP Request node)
* Processing individual files (use direct file attachments)

## Configuration

<img src="https://mintcdn.com/langdock-34/7T5PxfiNlawrX7FY/images/workflows/screenshots/FileSearchConfig.png?fit=max&auto=format&n=7T5PxfiNlawrX7FY&q=85&s=f7dbe6fa244084a66e81c6c2cf3dda9f" alt="File Search Configuration" width="3840" height="2160" data-path="images/workflows/screenshots/FileSearchConfig.png" />

### Folder

Select the folder to search from your workspace's available folders.

**Options:**

* Choose from connected folders
* Each folder contains your uploaded documents and files
* Folders support document files such as PDFs, Word docs, and text files. Spreadsheets and CSV files cannot be uploaded to Folders.

### Search Query

The search query to find relevant information. Supports Manual, Auto, and Prompt AI modes.

**Manual mode examples:**

```handlebars theme={null}
{{trigger.output.customer_question}}
```

```handlebars theme={null}
Find information about {{trigger.output.product_name}} pricing and features
```

**Prompt mode:**

```text theme={null}
Generate a search query to find relevant information about the customer's question: {{trigger.output.question}}
```

### Max Results

The maximum number of relevant results to return (default: 10)

**Recommendations:**

* **1-3 results**: Focused, specific queries
* **5-10 results**: Broader context needed
* **10+ results**: Comprehensive searches (may impact performance)

## How It Works

1. Query is processed against the selected folder
2. Semantic search finds the most relevant document chunks
3. Results are ranked by relevance score
4. Top N results are returned based on max results setting
5. Retrieved information is available to subsequent nodes

## Example Use Cases

### Customer Support with Knowledge Base

```text theme={null}
Form Trigger (Customer question)
→ File Search: Query folder with {{trigger.output.question}}
  Folder: "Support Documentation"
  Max Results: 5
→ Agent: Answer question using search results
  Context: {{file_search.output.results}}
  Question: {{trigger.output.question}}
→ Notification: Send answer to customer
```

### Product Information Lookup

```text theme={null}
Integration Trigger (Slack question about product)
→ File Search: Search product knowledge
  Folder: "Product Information"
  Query: {{trigger.output.message}}
  Max Results: 3
→ Agent: Summarize relevant product details
→ Action: Reply in Slack thread
```

### Document Validation

```text theme={null}
Form Trigger (User claim submission)
→ File Search: Find relevant policies
  Folder: "Company Policies"
  Query: "{{trigger.output.claim_type}} policy requirements"
  Max Results: 5
→ Agent: Validate claim against policies
  Policies: {{file_search.output.results}}
  Claim: {{trigger.output.claim_details}}
→ Condition: Approved or requires review?
```

## Accessing Search Results

Access the retrieved information in subsequent nodes:

```handlebars theme={null}
{{file_search.output.results}}
{{file_search.output.results[0].text}}
{{file_search.output.results[0].similarity}}
{{file_search.output.results[0].fileName}}
```

### Result Structure

Each result contains:

* **text**: The relevant text chunk from the document
* **similarity**: Relevance score (0-1, higher is more relevant)
* **fileName**: Name of the source file
* **fileUrl**: URL to access the source file
* **mimeType**: MIME type of the source file
* **subsource**: Additional source reference
* **subname**: Additional name reference
* **fileId**: Unique identifier for the source file
* **externalId**: External reference ID from the connected source system
* **fileSize**: Size of the file in bytes
* **connectionId**: ID of the integration connection that provided the file
* **syncParams**: Sync parameters from the source integration
* **pageCount**: Number of pages in the file

**Using in Agent prompts:**

```handlebars theme={null}
Context from knowledge base:
{{file_search.output.results}}

Based on the above context, answer this question:
{{trigger.output.question}}
```

## Limitations

* **Folder Scope**: Only searches within the selected folder
* **Result Quality**: Depends on quality and completeness of uploaded documents
* **Chunk Size**: Large documents are split into chunks; relevant information might span multiple results
* **Real-time Updates**: Document changes require reprocessing before they appear in search results

<Note>
  **Important**: Ensure your folders are regularly updated with current information for accurate search results.
</Note>

## Best Practices

<AccordionGroup>
  <Accordion title="Write Specific Search Queries">
    More specific queries return more relevant results. Include key terms, product names, or topics rather than generic searches.
  </Accordion>

  <Accordion title="Adjust Max Results Based on Use Case">
    Start with 5 results and adjust based on response quality. Too few might miss important context, too many can dilute relevance.
  </Accordion>

  <Accordion title="Keep Folders Organized">
    Organize folders by topic or domain for more targeted searches. Separate technical docs from marketing content.
  </Accordion>

  <Accordion title="Combine with Agent Nodes">
    File Search is most powerful when combined with Agent nodes. The agent can synthesize and interpret the retrieved information.
  </Accordion>

  <Accordion title="Test with Real Queries">
    Test your file search with actual questions users might ask to ensure folder content is sufficient and queries return relevant results.
  </Accordion>

  <Accordion title="Handle No Results">
    Add a condition after file search to handle cases where no relevant results are found. Provide fallback responses or escalation paths.
  </Accordion>
</AccordionGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Agent Node" icon="brain" href="/en/using-langdock/workflows/nodes/agent-node">
    Process and synthesize search results with AI
  </Card>

  <Card title="Folders" icon="folder" href="/en/using-langdock/library/folders">
    Learn how to set up and manage folders
  </Card>

  <Card title="Web Search" icon="magnifying-glass" href="/en/using-langdock/workflows/nodes/web-search-node">
    Search the internet for current information
  </Card>

  <Card title="Condition Node" icon="code-branch" href="/en/using-langdock/workflows/nodes/condition-node">
    Route based on search result quality
  </Card>
</CardGroup>
