Quote from: kylej at Mar 20, 2007, 07:12 AM
@andrazk: that probably would not be that hard to implement, I would love to see your suggestions.
Well, instead of searching sitewide I’d like to narrow the search to the documents in a specified branch of the document tree.
That’s why I’d add a parameter, say "topNodeId" or "parentId", defining the top document for the search. This would mean that only it’s children would be searched and their respective TVs.
Considering the demo site included in the instlalation,
parentId=`0` would search the whole document tree,
parentId=`2` would search only the blog,
parentId=`15` would search only the MODx Features, and so on.
Of course, you could specify many "parents" as in
parentId=`2,4,3`
Next parameter is "includeParent" (boolean), which is rather selfdescribing.
Now, another parameter would be "depth" or "levels". If specified, only N levels of children would be searched.
Level=`1` would search only the direct children of the parent document.
Level=`2` would include the children’s children also.
Level=`0` would be a pretty useless setting, with or without includeParent set to true.
A wicked idea is maybe a parameter "lastChildOnly", which would search only the documents that have no children. In a structure
news (1)
category 1 (2)
article 1 (6)
article 2 (7)
category 2 (3)
subcategory 1 (4)
article 3 (8)
article 4 (9)
subcategory 2 (5)
article 5 (10)
article 6 (11)
article 7 (12)
it would search only the articles (6,7,8,9,10,11,12), no other pages.
If this is too strict, add a parameter
includeDocId=`3,4`, which would add individual pages to the search. As a counter-parameter,
excludeDocId=`8,7` would exclude the document with Id = 7 and Id = 8, even if it is one of the articles.
Another feature, exclude a whole tree branch with
excludeParentId=`4` (which in our example would exclude whole "subcategory 1").
Parameter consideration sequence:
1 - includeParent
2 - collect all children of parentId
3 - add includeDocId
4 - remove excludeDocId
5 - remove excludeParentId
All parameters take multiple ids.
Examples
[!AjaxSearch? &parentId=`2,3` &includeParent=`1`!] is equal to [!AjaxSearch? &parentId=`1` &includeParent=`0`!]
[!AjaxSearch? &parentId=`2,3` &includeParent=`0`!] would search all documents where Id > 3
[!AjaxSearch? &parentId=`3` &excludeDocId=`11` &lastChildOnly=`1` !] would search Id in [6,7,8,9,10,12]
[!AjaxSearch? &parentId=`3` &excludeDocId=`11` &excludeParentId=`5` !] would search Id in [4,5,8,9,12]
[!AjaxSearch? &parentId=`3` &excludeDocId=`11` &excludeParentId=`5` &includeParent=`1` !] would search Id in [3,4,8,9,12]
Anything else?

If help needed, tell me, glad to code.