I am currently accessing the path attribute of a media node (in order to index its ancestor for PDF full index search, but that’s not necessary to know for this question), and I’m quite surprised to find that not all ancestors are actually listed in the comma-delimited list of all ancestors!
For example, if I’ve got a media tree like the following:
-Media Group 1 (id: 123)
-
- Sub Group 1 (id: 234)
-
-
- some-pdf.pdf (id: 334)
-
-Media Group 2 (id: 1023)
-
- Sub Group 1 (id: 1234)
-
-
- some-other-pdf.pdf (id: 1334)
-
I would expect that the path for some-pdf.pdf would be { -1, 234, 123} and some-other-pdf.pdf to be {-1, 1023, 1234 } but what I’m finding is that surprisingly often, the grandparents aren’t present! For example, some-pdf.pdf would be { -1, 234 } and some-other-pdf.pdf is { -1, 1234 }.
This is particularly problematic because I need to know what the Media Group is as a client requires that a search can be filtered by the group (meaning the level 1 folder for each PDF in meda).
Is this particular to my installation for some reason or is it really that I can’t rely on “path” to be accurately containing all ancestors, particularly the first level ones?
Thanks in advance,
Ted
UPDATE:
Maybe the context does matter more than I thought: it appears that while the complete ancestor path is indeed in the database (as expected), for some reason it’s not available in the context I need it in:
private void Indexer_GatheringNodeData(object sender, IndexingNodeDataEventArgs e)
{
//Log.Add(LogTypes.Debug, 0, "PDFIndexer node indexed.");
var node = e.Node;
if (node.HasAttributes)
{
var path = node.Attribute("path").Value;
…
For some reason the path attribute at this point is (only sometimes) incomplete as described above.
As there doesn’t appear to be any answer forthcoming, see above for update.