Verwenden Sie das folgende Verfahren, um eine Fuzzy-Volltextsuche in einem Textindex auszuführen, der einen NGRAM-Begriffsegmentierer verwendet.
Starten Sie Interactive SQL und stellen Sie eine Verbindung mit der Beispieldatenbank unter Verwendung der SQL Anywhere 12 Demo-Datenquelle her.
Führen Sie die folgende Anweisung aus, um ein Textkonfigurationsobjekt namens "myFuzzyTextConfig" zu erstellen.
CREATE TEXT CONFIGURATION myFuzzyTextConfig FROM default_char; |
Führen Sie die folgende Anweisung aus, um den Begriffsegmentierer auf NGRAM zu ändern und die Begriff-Höchstlänge auf 3 festzulegen. Fuzzy-Suchen werden unter Verwendung von N-Grammen durchgeführt. Separate ALTER TEXT CONFIGURATION-Anweisungen werden verwendet, um diese Änderungen zu implementieren.
ALTER TEXT CONFIGURATION myFuzzyTextConfig TERM BREAKER NGRAM; ALTER TEXT CONFIGURATION myFuzzyTextConfig MAXIMUM TERM LENGTH 3; |
Starten Sie Sybase Central und stellen Sie eine Verbindung mit der Beispieldatenbank unter Verwendung der SQL Anywhere 12 Demo-Datenquelle her.
Erstellen Sie eine Kopie der MarketingInformation-Tabelle.
In Sybase Central erweitern Sie den Ordner Tabellen.
Rechtsklicken Sie auf MarketingInformation und klicken Sie auf Kopieren.
Rechtsklicken Sie auf den Ordner Tabellen und klicken Sie auf Einfügen.
Im Feld Name geben Sie MarketingInformation2 ein. Klicken Sie auf OK.
Führen Sie in Interactive SQL die folgende Anweisung aus, um der Tabelle "MarketingInformation2" Daten hinzuzufügen:
INSERT INTO MarketingInformation2 SELECT * FROM MarketingInformation; |
Führen Sie die folgende Anweisung aus, um einen Textindex für die Spalte "MarketingInformation2.Description" zu erstellen, der das Textkonfigurationsobjekt "myFuzzyTextConfig" referenziert:
CREATE TEXT INDEX myFuzzyTextIdx ON MarketingInformation2 ( Description ) CONFIGURATION myFuzzyTextConfig; |
Führen Sie die folgende Anweisung aus, um auf Begriffe zu prüfen, die coten ähnlich sind:
SELECT MarketingInformation2.Description, ct.* FROM MarketingInformation2 CONTAINS ( MarketingInformation2.Description, 'FUZZY "coten"' ) ct ORDER BY ct.score DESC; |
Description | Score |
---|---|
<html><head><meta http-equiv=Content-Type content="text/html; charset=windows-1252"><title>Sweatshirt</title></head><body lang=EN-US><p><span style='font-size:10.0pt;font-family:Arial'>Lightweight
100% organically grown cotton hooded sweatshirt with taped neck seams. Comes pre-washed for softness and to lessen shrinkage.</span></p></body></html>
|
0.9461597363521859 |
<html><head><meta http-equiv=Content-Type content="text/html; charset=windows-1252"><title>Shorts</title></head><body lang=EN-US><p><span style='font-size:10.0pt;font-family:Arial'>These
quick-drying cotton shorts provide all day comfort on or off the trails. Now with a more comfortable and stretchy fabric and an adjustable drawstring
waist.</span></p></body></html>
|
0.9244136988525732 |
<html><head><meta http-equiv=Content-Type content="text/html; charset=windows-1252"><title>Visor</title></head><body lang=EN-US><p><span style='font-size:10.0pt;font-family:Arial'>Lightweight
100% organically grown cotton construction. Shields against sun and precipitation. Metallic ions in the fibers inhibit bacterial growth, and help neutralize
odor.</span></p></body></html>
|
0.9134171046194403 |
<html><head><meta http-equiv=Content-Type content="text/html; charset=windows-1252"><title>Sweatshirt</title></head><body lang=EN-US><p><span style='font-size:10.0pt;font-family:Arial'>Top-notch
construction includes durable topstitched seams for strength with low-bulk, resilient rib-knit collar, cuffs and bottom. An
80% cotton/20% polyester blend makes it easy to keep them clean.</span></p></body></html>
|
0.8856420222728282 |
<html><head><meta http-equiv=Content-Type content="text/html; charset=windows-1252"><title>Baseball Cap</title></head><body lang=EN-US><p><span style='font-size:10.0pt;font-family:Arial'>This
fashionable hat is ideal for glacier travel, sea-kayaking, and hiking. With concealed draw cord for windy days.</span></p></body></html>
|
0 |
<html><head><meta http-equiv=Content-Type content="text/html; charset=windows-1252"><title>Baseball Cap</title></head><body lang=EN-US><p><span style='font-size:10.0pt;font-family:Arial'>A
lightweight wool cap with mesh side vents for breathable comfort during aerobic activities. Moisture-absorbing headband liner.</span></p></body></html>
|
0 |
<html><head><meta http-equiv=Content-Type content="text/html; charset=windows-1252"><title>Tee Shirt</title></head><body lang=EN-US><p><span style='font-size:10.0pt;font-family:Arial'>We've
improved the design of this perennial favorite. A sleek and technical shirt built for the trail, track, or sidewalk. UPF rating
of 50+.</span></p></body></html>
|
0 |
<html><head><meta http-equiv=Content-Type content="text/html; charset=windows-1252"><title>Tee Shirt</title></head><body lang=EN-US><p><span style='font-size:10.0pt;font-family:Arial'>A
sporty, casual shirt made of recycled water bottles. It will serve you equally well on trails or around town. The fabric has
a wicking finish to pull perspiration away from your skin.</span></p></body></html>
|
0 |
<html><head><meta http-equiv=Content-Type content="text/html; charset=windows-1252"><title>Tee Shirt</title></head><body lang=EN-US><p><span style='font-size:10.0pt;font-family:Arial'>This
simple, sleek, and lightweight technical shirt is designed for high-intensity workouts in hot and humid weather. The recycled
polyester fabric is gentle on the earth and soft against your skin.</span></p></body></html>
|
0 |
<html><head><meta http-equiv=Content-Type content="text/html; charset=windows-1252"><title>Visor</title></head><body lang=EN-US><p><span style='font-size:10.0pt;font-family:Arial'>A
polycarbonate visor with an abrasion-resistant coating on the outside. Great for jogging in the spring, summer, and early
fall. The elastic headband has plenty of stretch to give you a snug yet comfortable fit every time you wear it.</span></p></body></html>
|
0 |
Die letzten sechs Zeilen haben Begriffe, die übereinstimmende N-Gramme enthalten. Es wurden ihnen allerdings keine Punktewerte zugeteilt, weil alle Zeilen in der Tabelle diese Begriffe enthalten.
Trennen Sie die Verbindung zu Interactive SQL und Sybase Central.
(Optional) Setzen Sie die Beispieldatenbank (demo.db) in ihren ursprünglichen Zustand zurück.
![]() |
Kommentieren Sie diese Seite in DocCommentXchange.
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |