Skip to content

[Feature Request] Implement Semantic Search using Google Built-in AI #3

@GyeongHoKim

Description

@GyeongHoKim

🚀 Feature Request

Description

Enhance the current text-based search with semantic search capabilities using Google's Built-in AI (Chrome's on-device AI). This would allow users to find bookmarks based on meaning and context rather than just keyword matching.

Problem Statement

Currently, users must remember exact keywords or URLs to find bookmarks. For example:

  • Searching "machine learning tutorial" won't find a bookmark titled "Deep Learning Course for Beginners"
  • Searching "react hooks documentation" won't find "useEffect API Reference"

Proposed Solution

Integrate Google's Built-in AI Prompt API to:

  1. Generate embeddings for all bookmark titles and descriptions
  2. Convert search queries into semantic vectors
  3. Find bookmarks based on semantic similarity rather than text matching
  4. Provide a fallback to regular search when AI is unavailable

Implementation Details

// Example pseudo-code
async function semanticSearch(query) {
  const ai = await window.ai.assistant.create();
  
  // Generate embedding for search query
  const queryEmbedding = await ai.generateEmbedding(query);
  
  // Compare with cached bookmark embeddings
  const results = bookmarks.map(bookmark => ({
    bookmark,
    similarity: cosineSimilarity(queryEmbedding, bookmark.embedding)
  }));
  
  return results.sort((a, b) => b.similarity - a.similarity);
}

Benefits

  • Improved Discovery: Find bookmarks even when you don't remember exact titles
  • Natural Language: Search using questions like "how to center a div"
  • Multi-language Support: Search in one language, find bookmarks in another
  • Context-aware: Understands synonyms and related concepts

Acceptance Criteria

  • Semantic search returns relevant results for conceptually similar queries
  • Performance remains smooth (< 100ms search latency)
  • Graceful fallback when AI is unavailable
  • Settings option to toggle between semantic and regular search
  • Works offline with on-device AI

Additional Context

  • Google Built-in AI Prompt API documentation: Chrome AI Origin Trial
  • Could be combined with the existing regex search as a hybrid approach
  • Consider caching embeddings in IndexedDB for performance

Related Issues

  • Will complement the AI summarization feature
  • Can work alongside bookmark auto-categorization

Labels to add: enhancement, ai-feature, google-built-in-ai, good-first-issue

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions