式言語
最初の SELECT ステートメントでは 1.2、1.2.1、1.2.2 の文書が選択され、2 番目では 1.0、1.1、1.2、1.3 の文書、3 番目では 1.0、1.1、1.2、1.2.1、1.2.2、1.3 の文書、4 番目では 1.2.1 と 1.3 の文書が選択されます。
SELECT @Author = "Jim Thompson" | @AllChildren
SELECT @Author = "Esteban Garcia" | @AllChildren
SELECT @Author = "Esteban Garcia" | @AllDescendants
SELECT @Contains( Subject; "like" ) | @AllChildren
この場合、次のようなビューが表示されます。
Date Topic 04/08/95 The orchid family of flowers (Anne Davis, 2 responses) 04/08/95 Sighting of new variation (Brad Sullivan) 04/08/95 The "ghost" orchid (Rachel Greenbaum) 04/08/95 Local flower shops that carry orchids (Mary Tsen, 1 response) 04/08/95 Try the Blumenhaus (Anne Davis)
ところが、ビューでは蘭に関係なくデータベース全体のすべての返答文書が選択されています。たとえば、返答文書の階層表示を解除するとビューは次のように表示されます。
Date Topic 04/08/95 The orchid family of flowers (AnneDavis) 04/08/95 Sighting of new variation (Brad Sullivan) 04/08/95 Special varieties of roses (Michael Bowling) 04/08/95 My roses bloomed late this year (Marcel DuBois) 04/08/95 Local flower shops that carry orchids (Mary Tsen) 04/08/95 Try the Blumenhaus (Anne Davis) 04/08/95 The "ghost" orchid (Rachel Greenbaum)
不要な文書が、データベースのあるサーバー上のビュー索引でかなりの容量を占めてしまいます。また、この同じ式で複製を実行すると、不要な文書も複製されてしまいます。
ここで、@AllChildren を使って選択式を書き直します。
SELECT @Contains( Subject; "orchid" ) | @AllChildren
この式では、親文書の [Subject] フィールドに「orchid」が含まれる返答文書だけが選択され表示されます。ビューには非表示返答文書は含まれません。
しかし、作成したばかりの [Orchid] ビューには必要のない文書も含まれています。ここで、@AllChildren を使うと、選択条件に合う親文書の次レベルの子文書だけが選択されます。
Date Topic 04/08/95 The orchid family of flowers (Anne Davis, 4 responses) 04/08/95 Sighting of new variation (Brad Sullivan) 04/08/95 The "ghost" orchid (Rachel Greenbaum, 2 responses) 04/08/95 Very difficult to see (Brad Sullivan) 04/08/95 Some sightings reported in Florida (Anne Davis) 04/08/95 Local flower shops that carry orchids (Mary Tsen, 1 response) 04/08/95 Try the Blumenhaus (Anne Davis)
この場合は、@AllDescendants を使うほうがよいでしょう。選択式を次のように書き直します。
SELECT @Contains( Subject; "orchid" ) | @AllDescendants
これで、[Orchid] ビューに含まれるのは、蘭に関する文書だけになります。
Date Topic 04/08/95 The orchid family of flowers (Anne Davis, 7 responses) 04/08/95 Sighting of new variation (Brad Sullivan, 2 responses) 04/08/95 What color?(Anne Davis) 04/08/95 Please post exact location (Mary Tsen) 04/08/95 The "ghost" orchid (Rachel Greenbaum, 3 responses) 04/08/95 Very difficult to see (Brad Sullivan, 1 response) 04/08/95 Only blooms for an hour or so!(Rachel Greenbaum) 04/08/95 Some sightings reported in Florida (Anne Davis) 04/08/95 Local flower shops that carry orchids (Mary Tsen, 1 response) 04/08/95 Try the Blumenhaus (Anne Davis)