ウィッシュリスト検索クエリ管理

説明

ウィッシュリスト検索クエリ管理機能は、公式ウィッシュリストコンテキスト内での包括的な検索クエリ管理機能を提供し、ユーザーがウィッシュリストグループに関連付けられた検索クエリを表示・管理できるようにします。このシステムは最適化されたデータアクセスのためのサマリーテーブルと統合し、グループベースフィルタリング付きのキーワードベース検索機能を提供します。

この機能は以下を備えた本番対応の検索クエリ分析に焦点を当てています:

  • ページネーション付きウィッシュリストコンテキスト内での検索クエリ一覧表示
  • 最適化された検索データアクセスのためのサマリーテーブルとの統合
  • グループベースアクセス制御とフィルタリング
  • キーワードグループ化と重複除去
  • リアルタイム検索クエリステータス追跡と管理
  • モール固有のキーワード処理

システムは適切な関係管理を通じてデータ整合性を確保し、包括的な分析と戦略的インサイトのための検索データへの効率的なアクセスを提供します。

アクティビティ図

---
config:
  theme: base
  layout: dagre
  flowchart:
    curve: linear
    htmlLabels: true
  themeVariables:
    edgeLabelBackground: "transparent"
---
flowchart TB
    %% Main components
    UserRequest[ユーザーリクエスト]
    Database[(Database)]
    
    subgraph Controllers
        SearchQueryController[WishlistSearchQueryController]
    end
    
    subgraph Repositories
        SearchQueryRepo[[SummaryWishlistSearchQueryRepository]]
        WishlistRepo[[WishlistToGroupRepository]]
    end
    
    subgraph Middleware
        AuthMiddleware{AuthMiddleware}
    end
    
    UserRequest --- Step1[
        <div style='text-align: center'>
            <span style='display: inline-block; background-color: #6699cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>1</span>
            <p style='margin-top: 8px'>認証・ウィッシュリスト検証</p>
        </div>
    ]
    Step1 --> AuthMiddleware
    AuthMiddleware --> SearchQueryController

    SearchQueryController --- Step2[
        <div style='text-align: center'>
            <span style='display: inline-block; background-color: #6699cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>2</span>
            <p style='margin-top: 8px'>検索クエリデータ取得・処理</p>
        </div>
    ]
    Step2 --> WishlistRepo
    WishlistRepo --> SearchQueryRepo

    SearchQueryRepo --- Step3[
        <div style='text-align: center'>
            <span style='display: inline-block; background-color: #6699cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>3</span>
            <p style='margin-top: 8px'>キーワードグループ化・データ処理</p>
        </div>
    ]
    Step3 --> Database

    Database --- Step4[
        <div style='text-align: center'>
            <span style='display: inline-block; background-color: #6699cc !important; color:white; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; font-weight: bold'>4</span>
            <p style='margin-top: 8px'>データフォーマット・レスポンス生成</p>
        </div>
    ]
    Step4 --> SearchQueryController

    %% Styling
    style UserRequest fill:#e6f3ff,stroke:#0066cc,stroke-width:2px
    style Database fill:#ffe6cc,stroke:#ff9900,stroke-width:2px
    style Controllers fill:#e6f3ff
    style Repositories fill:#fff0f5
    style Middleware fill:#f5f0ff
    style Step1 fill:transparent,stroke:transparent,stroke-width:1px
    style Step2 fill:transparent,stroke:transparent,stroke-width:1px
    style Step3 fill:transparent,stroke:transparent,stroke-width:1px
    style Step4 fill:transparent,stroke:transparent,stroke-width:1px

詳細データフロー依存関係

ステップバイステッププロセス

ステップ1: 認証・ウィッシュリスト検証

  • 説明: 検索クエリ操作のためのユーザー認証とウィッシュリストアクセスを検証
  • アクション: ユーザーセッション認証、ウィッシュリスト所有権検証、ウィッシュリスト存在チェック
  • 入力: ユーザー認証情報、ウィッシュリストスラッグ
  • 出力: ウィッシュリストアクセス確認付きの検証されたユーザーコンテキスト
  • 依存関係: ユーザー認証サービス、ウィッシュリストリポジトリ
  • 外部サービス: 認証プロバイダー

ステップ2: 検索クエリデータ取得・処理

  • 説明: ウィッシュリスト情報を取得し、グループベースフィルタリングで検索クエリデータを処理
  • アクション: スラッグでウィッシュリスト検索、グループフィルタリング付きサマリー検索クエリクエリ、ページネーション適用
  • 入力: ウィッシュリストスラッグ、ページネーションパラメータ、グループコンテキスト
  • 出力: サマリー情報とグループフィルタリング付きのページネーション検索クエリデータ
  • 依存関係: ウィッシュリストリポジトリ、サマリー検索クエリリポジトリ、グループ検証
  • 外部サービス: データベースクラスター、グループ管理サービス

ステップ3: キーワードグループ化・データ処理

  • 説明: キーワードグループ化と重複除去で検索クエリデータを処理
  • アクション: キーワードグループ化適用、重複除去、モール固有キーワード処理
  • 入力: 検索クエリデータ、グループ化パラメータ、キーワード処理ルール
  • 出力: キーワードグループ化と重複除去付きの処理された検索クエリデータ
  • 依存関係: キーワード処理、グループ化アルゴリズム、データ重複除去
  • 外部サービス: データベースクエリ最適化、キーワード処理サービス

ステップ4: データフォーマット・レスポンス生成

  • 説明: 適切な構造とページネーション付きのAPIレスポンス用に検索クエリデータをフォーマット
  • アクション: データをAPI形式に変換、ページネーションメタデータ適用、レスポンス構造生成
  • 入力: 処理された検索クエリデータ、ページネーションメタデータ、レスポンス形式要件
  • 出力: ページネーションとキーワードデータ付きのフォーマットされたAPIレスポンス
  • 依存関係: データ変換サービス、レスポンスフォーマット
  • 外部サービス: APIレスポンスサービス、データシリアライゼーション

データベース関連テーブル・フィールド

データベース: gb_console

erDiagram
    wishlist_search_queries {
        bigint id PK
        bigint group_id FK
        bigint wishlist_to_group_id FK
        bigint summary_wishlist_search_query_id FK
        integer status "0: 非アクティブ, 1: アクティブ"
    }
    
    summary_wishlist_search_queries {
        bigint id PK
        bigint mall_id FK "モールのID"
        string keyword "検索するキーワード"
        integer sending_status "クローラーへの送信ステータス"
        integer crawl_status "クローリングのステータス"
        integer status "商品のステータス"
    }
    
    wishlist_to_groups {
        bigint id PK
        string name "ウィッシュリストの名前"
        string slug "ウィッシュリストのスラッグ"
        integer status "0: 非アクティブ, 1: アクティブ, 3: キャンセル"
    }
    
    malls {
        bigint id PK
        string name
    }
    
    wishlist_search_queries }|--|| wishlist_to_groups : "所属"
    wishlist_search_queries }|--|| summary_wishlist_search_queries : "参照"
    summary_wishlist_search_queries }|--|| malls : "所属"

ケースドキュメント

ケース1: ウィッシュリスト検索クエリ一覧

API: ウィッシュリスト検索クエリ一覧

シーケンス図

sequenceDiagram
    participant Client
    participant Controller as WishlistSearchQueryController
    participant WishlistRepo as WishlistToGroupRepository
    participant SearchQueryRepo as SummaryWishlistSearchQueryRepository
    participant Database
    
    Note over Client,Database: ウィッシュリスト検索クエリ一覧フロー
    
    rect rgb(255, 255, 200)
    Note right of Client: 認証フェーズ
    Client->>Controller: GET /api/v1/wishlist-to-group/{slug}/wishlist-search-query
    Controller->>Controller: ユーザー認証
    end
    
    rect rgb(200, 230, 255)
    Note right of Controller: ウィッシュリスト検証
    Controller->>WishlistRepo: findBySlug(slug)
    WishlistRepo->>Database: wishlist_to_groupsからSELECT
    Database-->>WishlistRepo: ウィッシュリストレコード
    WishlistRepo-->>Controller: ウィッシュリストまたはnull
    end
    
    rect rgb(200, 255, 255)
    Note right of Controller: 検索クエリデータ取得
    alt ウィッシュリスト見つかった
        Controller->>SearchQueryRepo: serverPaginationFilteringFor(params, wishlistId)
        SearchQueryRepo->>Database: グループフィルタリングとキーワードグループ化付きSELECT
        Database-->>SearchQueryRepo: ページネーション検索クエリ
        SearchQueryRepo-->>Controller: 検索クエリコレクション
    else ウィッシュリスト見つからない
        Controller-->>Client: エラーレスポンス
    end
    end
    
    rect rgb(200, 255, 200)
    Note right of Controller: 成功レスポンス
    Controller->>Controller: リソースに変換
    Controller-->>Client: 検索クエリ付きJSONレスポンス
    end

ステップ

  1. 認証: ユーザーセッションを検証
  2. ウィッシュリスト検証: スラッグでウィッシュリストを検索し存在を検証
  3. 検索クエリデータ取得: グループフィルタリングとキーワードグループ化付きサマリー検索クエリをクエリ
  4. レスポンス生成: APIリソースに変換しフォーマットされたレスポンスを返却

エラーハンドリング

  • 401 Unauthorized: 無効な認証
  • 404 Not Found: ウィッシュリストが見つからない
  • 500 Internal Server Error: データベースまたはシステムエラー