newOS for Developers

Back to Search Methods

Keyword Search

Tag-based search for posts and moods

beginnerGET /post/list/tags-search

Overview

Keyword search performs exact tag matching against posts and moods stored in Neo4j. Unlike semantic search, this looks for exact matches in the tags field, making it faster but less flexible.

Use this when you know the exact tags you're looking for, such as "#photography" or "#ai-art".

API Endpoint

GET/post/list/tags-search

Query Parameters:

  • tags — Comma-separated list of tags
  • page — Pagination cursor (optional)
  • direction — "asc" or "desc" (optional)

Usage Example

import { searchByTags } from "@newgraph-signals/actions/post";

// Search for posts with specific tags
const results = searchByTags({ 
  tags: ["photography", "nature"],
  page: "0"
});

// Raw API call
const response = await newgraphClient.api.post.listTagsSearch({
  query: {
    tags: "photography,nature",
    page: "0"
  }
});

Response Schema

// PagedResponse<PostReadResponse>
{
  value: [
    {
      id: string;
      title: string;
      description: string;
      contentUrl: string;
      tags: string[];
      author: { id: string; username: string; };
      created: string;
    }
  ],
  done: boolean;
  page: string;   // Next page cursor
}

Performance Notes

Latency

~100ms average (direct Neo4j query)

Backend

Neo4j graph database