If a team is importing an approved output from a collector at 2scraper, normalize a name for search only after keeping the source identity independently. This worked case shows how Unicode normalization and case folding can make two useful search candidates share a value. The script runs on mock product rows and keeps distinct source keys intact.
Define the two operations together
A search function compares what a person typed with words in a presentation field. A stable key identifies the record that an importer will update. A person might use a familiar spelling or full-width Latin letters and still want both candidates. A join must obey a documented identifier scope and preserve independent rows. Write the data dictionary so each column says whether it participates in a search, a display or a storage identity.
A source key often has a marketplace, site or supplier component. Retain those components even if the browser renders only the name. The same name can exist under a second source key, and one product can have different display names over time. Keeping a separate derived index means you can rebuild search behavior after changing a rule without altering already recorded evidence or source identities.
Make collisions visible in the test packet
Use a synthetic pair that has identical derived search text and distinct source keys. A third name differs under the sample rule and should remain in its own result. Start the review using a simple search. The demonstrator can show which derived tokens are equal and which full keys are still separate. Both results are supported by the same source records when the scopes are presented clearly.
Compatibility normalization transforms a wide range of character representations. Choose it for a search use only after checking important distinctions for the languages affected. A receiving team may choose a different text normalization form, explicit transliteration or preserved punctuation. Record the approved rule version and test real examples with permitted data. An identity column deserves a separately reviewed source specification.
Run the synthetic fixture
The fixture creates a search index using compatibility normalization and case folding. Two names share a lookup key after normalization and keep two distinct catalog identities. The program also tests a separate item and a label update whose identity remains the same.
from collections import defaultdict
import unicodedata
def search_key(name):
return " ".join(unicodedata.normalize("NFKC", name).casefold().split())
rows = {
("JP","K1"): "Arc Speaker",
("JP","K2"): "Arc Speaker",
("JP","K3"): "Arc Stand",
}
index = defaultdict(list)
for key, name in rows.items():
index[search_key(name)].append(key)
assert sorted(index[search_key("arc speaker")]) == [("JP","K1"),("JP","K2")]
assert index[search_key("arc stand")] == [("JP","K3")]
rows[("JP","K1")] = "Arc Speaker, revised label"
assert len(rows) == 3 and rows[("JP","K2")] == "Arc Speaker"
for text, keys in sorted(index.items()):
print(text, sorted(keys))
print("source identities after a label edit:", len(rows))
arc speaker [('JP', 'K1'), ('JP', 'K2')]
arc stand [('JP', 'K3')]
source identities after a label edit: 3
The search index groups two names together. The source store still has three keys, and updating one display label leaves its neighboring record intact. The displayed index is the original revision before that label edit. Rebuild it from the accepted rows when an application makes the changed label searchable.
Review the boundary cases
Equivalent lookup terms. Search for full-width and ordinary Latin characters under the example rule. The expected result is the same set of two candidates. The preserved source keys show that the result contains two distinct rows.
Identical display after a rename. Give one row a label already used by another. The expected result is two immutable source identities. Renaming cannot overwrite another product.
Out-of-scope normalization. Try the rule on a fixture name where a compatibility distinction matters. The expected result is a documented review before rollout. The search owner can define expected behavior in the relevant language.
Out-of-order import. Reverse fixture ordering before building the index. The expected result is the same set of source IDs. Candidate order may have its own approved ranking rule.
Keep a search update reproducible
Treat a new search rule as an index revision. Compare old and new results with a limited set of non-sensitive fixture terms. A newly merged search bucket can be a valid usability improvement. If the same rule also changes a report total, follow the importer and make sure search terminology has not entered a data key. A useful release note lists behavior changes by interaction and publishes the exact rule version for review.
A lookup can return several candidates with the same normalized text. Expose enough distinguishing context for a user to choose one safely. An automated update should require a valid durable key. If an old integration accepts only a display label, hold ambiguous records or route them to a reviewer before trying to guess. Retain the source reference with each published report so a user can independently see which catalog identity supplied the row.
Choose acceptance criteria before changing the index
Have the catalog team inspect a fixture with equal normalized text from two separate keys. Record the expected number of search results and the expected number of importer inserts. Count the total and sample the actual identities. A test that only counts found rows may miss that one candidate was replaced by a different one. A key-level comparison makes the failure specific enough for the correct owner to fix.
Re-run a fixture whose row order changes. The same valid candidates should remain identifiable irrespective of which row arrived first. If ranking uses a policy, say what that ranking does after the candidates are built. For example an exact display match may sort first while both candidates remain present. Ranking and record identity should be visible as two testable effects. When any changed rule is rolled back, the previous lookup can be rebuilt from the same retained source.
Keep the evidence with the decision
I would make the review packet small enough that the team that maintains catalog identity and search can read it without the development environment. Start with a catalog identity dictionary and a reproducible search fixture. Put the rule and its version beside the inputs and name the comparison grain as one marketplace and source product key with an independently derived search value. The reader should be able to mark each item independently with one disposition before looking at what the program did. Ask them to point to the field and source behind at least one accepted item. If they can only infer the rule from a convenient example, the packet is still missing an explicit assumption.
For each outcome in stable source rows and explicitly grouped lookup candidates, keep a bounded reference to the original evidence and the reason it passed. Give a search collision whose interpretation needs a human a distinct disposition and a visible route for another review. That route should describe the missing information without implying that an unobserved event occurred. A report that silently drops unresolved rows can look unusually clean, and downstream counts can change after a reviewer supplies the missing evidence. Record which observations left the reviewed population and the rule that decides when they may re-enter it.
Use source key, search rule revision and rendered display label to confirm that an ordinary report can be reconstructed from a dated source. Keep a copy of the earlier rule when it is still used to interpret a previous report. A new decision should have its own effective date and evidence reference. Make an independent reviewer run the same small case, then ask them why the earlier and later outcomes differ. This will also show whether a changed summary was caused by a new input, an updated decision rule, or a change in formatting and labeling.
Decide where the data stops moving if a required part of a catalog identity dictionary and a reproducible search fixture is unavailable. If the usual reader can use a prior validated output, give it a timestamp and label that output as the last valid observation. Send reviewers a short reason that identifies a search collision whose interpretation needs a human within the scope of one marketplace and source product key with an independently derived search value. Avoid putting a raw private record or secret into the report to make support easier. The normal access controls can retain those details while the handoff preserves enough information to reproduce the classification.
Exercise the handoff before depending on it
Give two people comparable copies of the fixture. Ask one to explain which conclusions the output supports and one to identify the first place a bad result becomes visible. Both should have the same definitions of stable source rows and explicitly grouped lookup candidates. Then replace only one record with an unresolved variant. A clear workflow can tell the user the item is waiting on evidence without giving it the same status as an established failure. Capture the wording and the first place in the process where the decision changes.
Check cases where the export itself is valid but the context is wrong. Use one complete example outside one marketplace and source product key with an independently derived search value and see whether the routine workflow keeps it out of the result. Then change the input order and verify that the same report can still be reproduced. Where sequence is meaningful, record how it was established and add an explicit opposite-case test. An accidental dependence on an input file ordering can be difficult to notice when a successful run only shows final totals.
For the first real rollout, run the new check against one small approved sample and retain the earlier interpretation for comparison. Count the visible outcomes and sample one that changed and one that stayed the same. When the differences concern a search collision whose interpretation needs a human, confirm what a reader would do next and which owner has the evidence needed to act. Leave the previous release available until the team that maintains catalog identity and search can explain any material differences that affect ordinary decisions.
Record one success criterion and one reason to stop the rollout before the first real run. A useful criterion names stable source rows and explicitly grouped lookup candidates and says who will verify it. A stop decision should identify whether the failure affects the whole report or only a documented subset. Keep the recorded disposition separate from the decision to review a new release. This protects a prior evidence packet while allowing the team to correct a rule that only appeared to work on a convenient sample.
Try a two-key search collision
Pick a documented source at 2scraper for your permitted workflow. Reproduce a normalized name collision with two invented keys and make them both visible to the reviewer. Verify that the corresponding source records stay distinct when the lookup rule changes.
Prepared with AI assistance. The code was run on local synthetic data. The example illustrates the reporting method. It makes no claim about measured service performance.
Further reading
Catch a Catalog Snapshot That Mixes Product and Offer Rows sets out why the reporting grain belongs with the selected key.
Resolve Conflicting Catalog Categories With a Versioned Rule gives another example of preserving source and derived values.

Top comments (0)