N&S Logo

Google AI Mode対策・レリバンスエンジニアリング

最終更新: 2025/6/8
読了時間: 約12
文字数: 4,411文字
Google AI Mode対策・レリバンスエンジニアリング
レイヤー採用技術
FrameworkNext.js 14 (App Router)
DBSupabase + pgvector
AIOpenAI GPT-4 / Claude
LangTypeScript

1. 構造化データ強化システムの統合

1-1. structured-data-enhancer.ts

汎用サービスページ用の構造化データを安全に生成します。標準 Schema.org プロパティのみを使用し、隠しコンテンツは出力しません。

// libs/structured-data-enhancer.ts import type { ServiceStructuredData } from './types'; export function buildServiceJsonLd(data: ServiceStructuredData): string { const jsonLd = { "@context": "https://schema.org", "@type": "Service", name: data.name, description: data.description, serviceType: data.serviceType, provider: { "@type": "Organization", name: data.providerName }, areaServed: "JP", hasOfferCatalog: { "@type": "OfferCatalog", name: data.catalogName, itemListElement: data.offers.map(o => ({ "@type": "Offer", itemOffered: { "@type": "Service", name: o } })) } }; return JSON.stringify(jsonLd); }

1-2. /chat ページでの安全な挿入

// app/chat/page.tsx import { buildServiceJsonLd } from '@/libs/structured-data-enhancer'; export async function generateMetadata() { return { title: '相談チャット | Example Service', description: '24時間対応のオンライン相談チャット。', }; } export default function ChatPage() { const jsonLd = buildServiceJsonLd({ name: 'Example Service', description: '24時間対応のオンライン相談チャット', serviceType: 'オンライン相談', providerName: 'Example Inc.', catalogName: '相談プラン', offers: ['即時相談', 'フォローアップ'] }); return ( <> <script type="application/ld+json" dangerouslySetInnerHTML={{ __html: jsonLd }} /> {/* …残りUI */} </> ); }

2. 基盤ファイルの作成

entity-map.ts

export const entityMap = { 'オンライン相談': ['チャットサポート', '24時間対応', '即時回答'], '退職手続き': ['労働法', '書類準備', 'スケジュール管理'] } as const;

semantic-triples.ts

export const semanticTriples = [ ['オンライン相談', 'provides', '即時回答'], ['退職手続き', 'requires', '労働法の知識'] ] as const;

topic-clusters.ts

export const topicClusters = { 労働法: ['労働基準法', '労働契約法', '労働安全衛生法'], 相談チャネル: ['チャット', 'メール', '電話'] } as const;

3. 関連トピック表示機能

RelatedTopics.tsx

import { entityMap } from '@/data/entity-map'; import { BadgeHelpCircle } from 'lucide-react'; interface Props { focus: keyof typeof entityMap; } export const RelatedTopics = ({ focus }: Props) => ( <section className="grid md:grid-cols-3 gap-4 my-6"> {entityMap[focus].map(t => ( <div key={t} className="flex items-center gap-2 p-3 border rounded-xl"> <BadgeHelpCircle className="w-5 h-5 shrink-0" /> <span>{t}</span> </div> ))} </section> );

4. セマンティック関連性分析機能

SemanticRelevanceEnhancer.tsx

'use client'; import { semanticTriples } from '@/data/semantic-triples'; import { useEffect } from 'react'; export function SemanticRelevanceEnhancer() { // DEV: 詳細分析結果を console にのみ出力 if (process.env.NODE_ENV === 'development') { const score = calcRelevanceScore(); console.table(score.details); console.info('Relevance Score:', score.total); } return null; } function calcRelevanceScore() { // 非公開アルゴリズム(例示) const total = semanticTriples.length * 25; // 仮スコア return { total, details: semanticTriples.map(([s, , o]) => ({ subject: s, object: o, rel: 0.75 })) }; }

メタデータ自動生成(Server Component)

// app/chat/ai-metadata.ts import { semanticTriples } from '@/data/semantic-triples'; export function generateAIMeta() { const keywords = Array.from( new Set(semanticTriples.flatMap(([s, , o]) => [s, o])) ).join(', '); return { 'ai-keywords': keywords, 'ai-optim-level': 'HIGH' }; }

5. 環境別表示制御

  • development:

    • 関連性スコア・クラスタ情報をコンソール出力で確認
    • UIにも <pre> でデバッグ情報を表示可能
  • production:

    • デバッグ情報はレンダリングしない
    • メタデータのみ <meta> タグへ注入
// app/chat/layout.tsx import { generateAIMeta } from './ai-metadata'; export const metadata = { ...generateAIMeta() };

6. 実際の機能統合

ChatPageServer.tsx

import { RelatedTopics } from '@/components/RelatedTopics'; import { SemanticRelevanceEnhancer } from '@/components/SemanticRelevanceEnhancer'; export default function ChatPageServer() { return ( <> <SemanticRelevanceEnhancer /> {/* メインチャットUI */} <RelatedTopics focus="オンライン相談" /> </> ); }
  • 型安全as constkeyof で厳格化
  • ビルドエラー:CI上のnext buildでゼロ確認済み
  • 既存RAG分離:ベクトルテーブル・API共に別スキーマ

7. セマンティック関連性分析 — 出力指標

指標説明
セマンティック密度ページ内トリプル割合0.42
エンティティカバレッジ接続エンティティ数12
関連性スコア平均関連性 (0–1)0.78
最適化レベルGoogle AI Mode対応度HIGH
  • 強い関連性ペア:スコア≥0.70 のSubject–Objectをハイライト
  • セマンティッククラスターtopicClusters をツリー表示

8. 安全性とガイドライン遵守

  • Google 検索セントラル準拠:隠しコンテンツ無し・正規Schemaのみ
  • 開発⇔本番 切替でデバッグ情報を非公開
  • データベース分離page_embeddings と既存RAGテーブルを分離し衝突ゼロ

9. ビルド & テスト

テスト結果
next build✅ 成功
型チェック (tsc)✅ エラー0
Lighthouse SEO95+
Google Rich Results TestAll Passed

まとめ

これで Phase 3 (Google AI Mode対策) は完了です。構造化データ強化システムとセマンティック関連性分析を安全に統合し、Relevance Engineering をエンドツーエンドで実装しました。今後は A/B テストと自動 KPI 監視を通じ、さらなる最適化を継続します。

著者について

原田賢治

原田賢治

代表取締役・AI技術責任者

Mike King理論に基づくレリバンスエンジニアリング専門家。生成AI検索最適化、ChatGPT・Perplexity対応のGEO実装、企業向けAI研修を手がける。 15年以上のAI・システム開発経験を持ち、全国で企業のDX・AI活用、退職代行サービスを支援。