Skip to main content
Replyke provides three semantic search hooks — one for content (entities, comments, messages), one for users, and one for spaces. All three return results ranked by semantic similarity to the query.

useSearchContent

Search across entities, comments, and chat messages. You can filter by sourceTypes to target only specific content types, or scope results to a specific space or conversation.
import { useSearchContent } from "@replyke/react-js";

function ContentSearch() {
  const { results, loading, search, reset } = useSearchContent();

  const handleSearch = async () => {
    await search({
      query: "posts about TypeScript best practices",
      sourceTypes: ["entity"],
      limit: 10,
    });
  };

  return (
    <div>
      <button onClick={handleSearch}>Search</button>
      {results.map((r) => (
        <div key={r.record.id}>
          [{r.sourceType}] {r.record.id} — similarity: {r.similarity.toFixed(2)}
        </div>
      ))}
    </div>
  );
}

Parameters (search function)

query
string
required
The natural language search query.
sourceTypes
("entity" | "comment" | "message")[]
Limit results to specific content types. Defaults to all types.
spaceId
string
Scope results to a specific space.
conversationId
string
Scope results to a specific conversation (for messages).
limit
number
Maximum number of results to return.

Returns

results
ContentSearchResult[]
Ranked results.
loading
boolean
true while a search is in progress.
error
string | null
Error message if the search failed.
Executes the search and updates results.
reset
() => void
Clears results and error state.

useSearchUsers

Search for users by natural language query — matches against name, username, bio, and other profile text.
import { useSearchUsers } from "@replyke/react-js";

function UserSearch() {
  const { results, search } = useSearchUsers();

  return (
    <button onClick={() => search({ query: "designers in Berlin", limit: 5 })}>
      Search Users
    </button>
  );
}

Parameters (search function)

query
string
required
The natural language search query.
limit
number
Maximum number of results to return.

Returns

results
UserSearchResult[]
Ranked user results.
loading
boolean
error
string | null
search
(props) => Promise<void>
reset
() => void

useSearchSpaces

Search for spaces by name, description, or topic.
import { useSearchSpaces } from "@replyke/react-js";

function SpaceSearch() {
  const { results, search } = useSearchSpaces();

  return (
    <button onClick={() => search({ query: "open source communities", limit: 5 })}>
      Find Spaces
    </button>
  );
}

Parameters (search function)

query
string
required
The natural language search query.
limit
number
Maximum number of results to return.

Returns

results
SpaceSearchResult[]
Ranked space results.
loading
boolean
error
string | null
search
(props) => Promise<void>
reset
() => void