Wenn Sie eine Volltextsuche mit einer Liste von Begriffen durchführen, ist die Reihenfolge der Begriffe ohne Bedeutung, außer sie sind Teil einer Phrase. Wenn Sie Begriffe in einen Phrase einfügen, sucht der Datenbankserver nach diesen Begriffen in genau derselben Reihenfolge und an denselben relativen Positionen, wie Sie sie eingegeben haben.
Wenn Begriffe bei einer Begriffs- oder Phrasensuche aus der Abfrage gelöscht werden, weil sie die Einstellungen für die Begriffslänge
überschreiten oder sich in der Stoppliste befinden, können Sie eine andere als die erwartete Zeilenanzahl erhalten. Der Grund
hierfür ist, dass ein Entfernen der Begriffe aus der Abfrage einer Änderung der Suchkriterien entspricht. Wenn Sie beispielsweise
nach der Phrase '"grown cotton"'
suchen und "grown" in der Stoppliste steht, erhalten Sie jede indizierte Zeile, die "cotton" enthält.
Sie können nach Begriffen suchen, die als Schlüsselwörter in der Grammatik der CONTAINS-Klausel angesehen werden, solange sie sich innerhalb von Phrasen befinden.
In der Beispieldatenbank wurde ein Textindex namens MarketingTextIndex für die Spalte "Description" der Tabelle "MarketingInformation" erstellt. Die folgende Anweisung fragt die Spalte "MarketingInformation.Description" ab und gibt die Zeilen zurück, bei denen der Wert der Spalte "Description" den Begriff cotton enthält.
SELECT ID, Description FROM MarketingInformation WHERE CONTAINS ( Description, 'cotton' ); |
ID | Description |
---|---|
906 | <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.cotton Metallic ions in the fibers inhibit bacterial growth, and help
neutralize odor.</span></p></body></html>
|
908 | <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>
|
909 | <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>
|
910 | <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>
|
Das folgende Beispiel fragt die Tabelle "MarketingInformation" ab und gibt einen einzelnen Wert für jede Zeile zurück, wobei angegeben wird, ob der Wert in der Spalte "Description" den Begriff cotton enthält.
SELECT ID, IF CONTAINS ( Description, 'cotton' ) THEN 1 ELSE 0 ENDIF AS Results FROM MarketingInformation; |
ID | Results |
---|---|
901 | 0 |
902 | 0 |
903 | 0 |
904 | 0 |
905 | 0 |
906 | 1 |
907 | 0 |
908 | 1 |
909 | 1 |
910 | 1 |
Das folgende Beispiel fragt die Tabelle "MarketingInformation" nach Einträgen ab, die den Begriff cotton in der Spalte "Description" haben, und zeigt den Punktewert für jede Übereinstimmung an.
SELECT ID, ct.score, Description FROM MarketingInformation CONTAINS ( MarketingInformation.Description, 'cotton' ) as ct ORDER BY ct.score DESC; |
ID | score | Description |
---|---|---|
908 | 0.9461597363521859 | <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>
|
910 | 0.9244136988525732 | <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>
|
906 | 0.9134171046194403 | <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>
|
909 | 0.8856420222728282 | <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>
|
Wenn Sie eine Volltextsuche mit einer Phrase durchführen, setzen Sie die Phrase in Anführungszeichen. Eine Spalte stimmt überein, wenn sie die Begriffe in der angegebenen Reihenfolge bzw. an den relativen Positionen enthält.
Sie können keine CONTAINS-Schlüsselwörter, wie z.B. AND oder FUZZY, als Begriffe angeben, nach denen gesucht werden soll, außer Sie setzen sie in eine Phrase (Ein-Begriff-Phrasen sind zulässig). Beispiel: Die untenstehende Anweisung ist annehmbar, obwohl NOT ein CONTAINS-Schlüsselwort ist.
SELECT * FROM table-name CONTAINS ( Remarks, '"NOT"' ); |
Mit der Ausnahme des Sternchens werden Sonderzeichen nicht als Sonderzeichen interpretiert, wenn sie sich innerhalb einer Phrase befinden.
Phrasen können nicht als Argumente in Nachbarschaftssuchen verwendet werden.
Die folgende Anweisung fragt "MarketingInformation.Description" nach der Phrase "grown cotton"
ab und zeigt den Punktewert für jede Übereinstimmung an:
SELECT ID, ct.score, Description FROM MarketingInformation CONTAINS ( MarketingInformation.Description, '"grown cotton"' ) as ct ORDER BY ct.score DESC; |
ID | score | Description |
---|---|---|
908 | 1.6619019465461564 | <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>
|
906 | 1.6043904700786786 | <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>
|
![]() |
Kommentieren Sie diese Seite in DocCommentXchange.
|
Copyright © 2013, SAP AG oder ein SAP-Konzernunternehmen. - SAP Sybase SQL Anywhere 16.0 |