@aiquants/contact-map 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -125,23 +125,28 @@ export default function ContactMapRoute() {
125
125
 
126
126
  ## Search Normalization / 検索語の正規化
127
127
 
128
- The search page normalizes the typed query with `normalizeSearchInput` (exported from `@aiquants/contact-map`) before using it in three places: the fuzzy search term, the exact-match ranking term and the highlight query. The contact fields (name, company, department, title, email, phone numbers) are matched as stored. The query is therefore only brought into a form those fields can hold:
128
+ The search page normalizes the typed query with `normalizeSearchInput` (exported from `@aiquants/contact-map`) into the fuzzy search term. The contact fields (name, company, department, title, email, phone numbers) are matched as stored. The query is therefore only brought into a form those fields can hold:
129
129
 
130
130
  - Invisible characters (U+200B, U+FEFF) are removed, and surrounding whitespace (U+3000 and U+00A0 included) is trimmed.
131
131
  - Width, kana (hiragana → katakana) and case are unified with select-box's `normalizeText` (`ABC商事` → `abc商事`, `さとう` → `サトウ`). Kana stays as written (`つづき` → `ツヅキ`).
132
132
  - The query is replaced by its katakana reading only when the whole query is romaji that reads completely. It must hold only Latin letters and whitespace, and select-box's `romajiToKatakana` must leave no letter untransliterated (`tanaka` → `タナカ`, `yamada taro` → `ヤマダ タロ`, `tsuduki` → `ツヅキ`).
133
133
  - Mixed text, digits and symbols, and words that do not read completely keep their width / kana / case form (`user@corp.co.jp`, `営業部 tanaka`, `tanaka1`, `ke-su`, `sony`).
134
134
 
135
- The highlight marks the spellings that `getSearchQuerySpellings(query)` lists: select-box's `getNormalizedVariants` of each word of the query and of its normalized form. A kana reading is therefore marked only when the whole query reads as romaji. The select-box peer range is ^0.11.0, expanded from `workspace:^` at publish.
135
+ The result highlight and the exact-match ranking are one derivation from the query as typed. `createSearchQueryPattern(query)` finds the spellings that `getSearchQuerySpellings(query)` lists (select-box's `getNormalizedVariants` of each word of the query and of its normalized form), longest first and case-insensitively.
136
+ `HighlightedText` marks its matches, and `createExactMatchRanker(query, fields)` moves the results with a match in one of the fields to the top, keeping the fuzzy order within each group. A field is therefore highlighted exactly when it ranks its record as an exact match. A kana reading is marked only when the whole query reads as romaji.
136
137
 
137
- 検索ページは入力された検索語を `normalizeSearchInput` (`@aiquants/contact-map` から公開) で正規化してから、3 か所で使う: あいまい検索の検索語、完全一致による並べ替えの検索語、ハイライトの検索語。連絡先のフィールド (氏名・会社・部署・役職・メール・電話番号) は保存されたままの値で照合する。そのため検索語は、それらのフィールドが持ちうる形に揃えるだけ:
138
+ The typed query is used because normalization can drop a spelling it holds. select-box reads a prolonged sound mark that follows no kana as a hyphen, so `ーヒー` (the middle of `コーヒー`) becomes the search term `-ヒー`, while the highlight and the ranking still find `ーヒー`. The search outlet context carries both: `searchQuery` (as typed) and `searchTerm` (`normalizeSearchInput(searchQuery)`). The select-box peer range is ^0.11.0, expanded from `workspace:^` at publish.
139
+
140
+ 検索ページは入力された検索語を `normalizeSearchInput` (`@aiquants/contact-map` から公開) で正規化し、あいまい検索の検索語にする。連絡先のフィールド (氏名・会社・部署・役職・メール・電話番号) は保存されたままの値で照合する。そのため検索語は、それらのフィールドが持ちうる形に揃えるだけ:
138
141
 
139
142
  - 不可視文字 (U+200B・U+FEFF) を除き、端の空白 (U+3000・U+00A0 を含む) を除く。
140
143
  - select-box の `normalizeText` で全角/半角・かな (ひらがな → カタカナ)・大文字小文字を統一する (`ABC商事` → `abc商事`、`さとう` → `サトウ`)。かなは書いたまま (`つづき` → `ツヅキ`)。
141
144
  - 検索語全体が完全に読めるローマ字のときだけ、カタカナの読みに置き換える。ラテン文字と空白だけで、select-box の `romajiToKatakana` が音訳しない文字を残さないことが条件 (`tanaka` → `タナカ`、`yamada taro` → `ヤマダ タロ`、`tsuduki` → `ツヅキ`)。
142
145
  - 混在テキスト・数字や記号・完全には読めない語は、全角/半角・かな・大文字小文字の形のまま (`user@corp.co.jp`、`営業部 tanaka`、`tanaka1`、`ke-su`、`sony`)。
143
146
 
144
- ハイライトは `getSearchQuerySpellings(query)` が並べる表記に印を付ける。表記は、検索語の各語とその正規化形の各語に対する select-box の `getNormalizedVariants`。そのため、かなの読みに印が付くのは検索語全体がローマ字として読めるときだけ。select-box のピア範囲は ^0.11.0 (公開時に `workspace:^` から展開)。
147
+ 検索結果のハイライトと完全一致による並べ替えは、入力されたままの検索語からの 1 つの導出。`createSearchQueryPattern(query)` は `getSearchQuerySpellings(query)` が並べる表記 (検索語の各語とその正規化形の各語に対する select-box の `getNormalizedVariants`) を、最長のものから大文字小文字を区別せずに探す。`HighlightedText` はその一致に印を付け、`createExactMatchRanker(query, fields)` はいずれかのフィールドに一致を持つ結果を先頭へ移す (各グループ内ではあいまい検索の順序を保つ)。そのため、フィールドにハイライトが付くのは、そのフィールドがレコードを完全一致として並べさせるときちょうど。かなの読みに印が付くのは検索語全体がローマ字として読めるときだけ。
148
+
149
+ 入力されたままの検索語を使うのは、正規化が検索語の持つ表記を落とすことがあるため。select-box はかなに続かない長音記号をハイフンと読むので、`ーヒー` (`コーヒー` の途中) は検索語 `-ヒー` になるが、ハイライトと並べ替えは `ーヒー` を探し続ける。検索のアウトレットコンテキストは両方を運ぶ: `searchQuery` (入力されたまま) と `searchTerm` (`normalizeSearchInput(searchQuery)`)。select-box のピア範囲は ^0.11.0 (公開時に `workspace:^` から展開)。
145
150
 
146
151
  ## Localization / UI 言語
147
152
 
package/dist/client.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from "react";
2
2
  import { CSSProperties, ReactNode, RefObject, PointerEvent, MouseEvent } from "react";
3
3
  import { UseFuzzySearchOptions } from "@aiquants/fuzzy-search/react";
4
- import { C as ContactRecord, a as ContactMapStreamPhase, b as ContactMapSearchOutletContext, c as ContactMapOutletContext, d as ContactMapLogger, S as SerializedContactStreamRow } from "./wire-BxEK32O0.mjs";
4
+ import { C as ContactRecord, a as ContactMapStreamPhase, b as ContactMapSearchOutletContext, c as ContactMapOutletContext, d as ContactMapLogger, S as SerializedContactStreamRow } from "./wire-CFgYO13H.mjs";
5
5
  import { DirectoryTreeLabels, DirectoryTreeVirtualScrollOptions } from "@aiquants/directory-tree";
6
6
  import * as _aiquants_virtualscroll from "@aiquants/virtualscroll";
7
7
  import { VirtualScrollLocale } from "@aiquants/virtualscroll";
package/dist/client.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from "react";
2
2
  import { CSSProperties, ReactNode, RefObject, PointerEvent, MouseEvent } from "react";
3
3
  import { UseFuzzySearchOptions } from "@aiquants/fuzzy-search/react";
4
- import { C as ContactRecord, a as ContactMapStreamPhase, b as ContactMapSearchOutletContext, c as ContactMapOutletContext, d as ContactMapLogger, S as SerializedContactStreamRow } from "./wire-BxEK32O0.js";
4
+ import { C as ContactRecord, a as ContactMapStreamPhase, b as ContactMapSearchOutletContext, c as ContactMapOutletContext, d as ContactMapLogger, S as SerializedContactStreamRow } from "./wire-CFgYO13H.js";
5
5
  import { DirectoryTreeLabels, DirectoryTreeVirtualScrollOptions } from "@aiquants/directory-tree";
6
6
  import * as _aiquants_virtualscroll from "@aiquants/virtualscroll";
7
7
  import { VirtualScrollLocale } from "@aiquants/virtualscroll";