# Advanced Content Search with Filters

## User Intent

"How do I combine semantic search with metadata filters? Show me complex search queries."

## Operation

**SDK Method**: `queryContents()` with comprehensive filters\
**Use Case**: Precision search with multiple criteria

***

## Code Example (TypeScript)

```typescript
import { Graphlit } from 'graphlit-client';
import { ContentTypes, SearchTypes, FileTypes, ObservableTypes } from 'graphlit-client/dist/generated/graphql-types';

const graphlit = new Graphlit();

const results = await graphlit.queryContents({
  search: "machine learning optimization",
  searchType: SearchTypes.Hybrid,  // Vector + keyword
  types: [ContentTypes.File],
  fileTypes: [FileTypes.Document],
  creationDateRange: {
    from: '2024-01-01',
    to: '2024-12-31'
  },
  collections: [{ id: 'research-papers-id' }],
  feeds: [{ id: 'arxiv-feed-id' }],
  observations: [{
    type: ObservableTypes.Person,
    observable: { id: 'author-id' }
  }],
  offset: 0,
  limit: 20
});

console.log(`Found ${results.contents.results.length} results`);
```

***

## Filter Combinations

**Content Type + Date**: Recent PDFs\
**Entity + Collection**: Person in project\
**Search + Feed**: Keywords in source\
**Multiple Types**: Flexible queries

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.graphlit.dev/api-guides/use-cases/content/content-search-with-filters.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
