FORMULA LANGUAGE
The first SELECT statement selects documents 1.2, 1.2.1, and 1.2.2; the second selects documents 1.0, 1.1, 1.2, and 1.3; the third selects documents 1.0, 1.1, 1.2, 1.2.1, 1.2.2, and 1.3; and the fourth selects documents 1.2.1 and 1.3.
SELECT @Author = "Jim Thompson" | @AllChildren
SELECT @Author = "Esteban Garcia" | @AllChildren
SELECT @Author = "Esteban Garcia" | @AllDescendants
SELECT @Contains( Subject; "like" ) | @AllChildren
You get this view:
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)
The view, however, is selecting every response document in the entire database, whether or not it has to do with orchids. For example, here's what the view looks like when the response hierarchy is turned off:
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)
The unneeded documents take up valuable space in the view index on the database server. (In addition, if you used this same formula for replication, the unneeded documents would be replicated).
You use @AllChildren to rewrite the selection formula:
SELECT @Contains( Subject; "orchid" ) | @AllChildren
This formula selects and displays only those response documents whose parent contains "orchid" in the Subject field. The view does not contain any hidden response documents.
The Orchid view you just created, however, does not contain all the documents you want. @AllChildren only selects the immediate children of any parent document(s) that meet the selection criteria:
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)
In this case, @AllDescendants might provide a better solution. You rewrite the selection formula:
SELECT @Contains( Subject; "orchid" ) | @AllDescendants
The Orchid view now contains entire threads of the orchid discussion:
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)