Exclude-Self doesn't work in DisplayMacro

When I use DisplayTable macro the "Exclude-Self" option doesn't work fine, because it shows current page instead of exclude it.


I've seen the lucene query something like "AND -PageID:5075807" when "Exclude-Self" is true. Instead of that, I write Where clause like "PageID NOT 5075807" and works fine.

Can be a possible bug?

2 answers

We have tested the Exclude-Self feature with the latest projectdoc Toolbox (version 1.10.3) on Confluence 5.9.10 and (unfortunately) it works as intended (using the syntax "... AND -PageID:5075807 ...).

May I ask you for the version of the projectdoc Toolbox and Confluence so that we could try to reproduce the problem? It would also help if you could add the query you are executing. Maybe there is a problem with the construction of the query. We tried some combinations, but everything worked fine.

We are using Confluence 5.9.8 and projectdoc toolbos 1.10.3

The query doesn't work is: 

query=(DirectAncestorId:50758072  AND -PageID:50758072) AND (DoctypeExact:"userxcharacter"),category=<null>,spaceKeys=<null>,contentTypes=[page],attachmentTypes=<null>,lastModified=<null>,contributor=<null>,labels=<null>,sort=<null>]

I unchecked Exclude-Self option and I write "PageID NOT 50758072" in Where field, then the query is:

query=(DirectAncestorId:50758072 AND PageID NOT 50758072) AND (DoctypeExact:"userxcharacter"),category=<null>,spaceKeys=<null>,contentTypes=[page],attachmentTypes=<null>,lastModified=<null>,contributor=<null>,labels=<null>,sort=<null>]

This query works as expected.

I've just to update projectdoc toolbox to version 1.11.0 and the issue is the same.

Thank you for your report!

I'm sorry to say that I still need your help to track this down.

To my knowledge these are valid queries:

  • Doctype="user-character" NOT PageID=41451771
  • Doctype="user-character" AND -PageID:41451771

But this is not

  •  Doctype="user-character" AND PageID NOT 41451771

While the first two create the intended results (the page with the given ID is excluded), the last example shows the empty list (which is wrong since I have three documents of type 'user-character').

Here are the screenshots:

 

image2016-5-13 11:8:18.png

The above shows the query with all documents in the result.

image2016-5-13 11:8:53.png

It would help us to track the problem down if you could describe your use case.

  • What documents do you have?
  • What does your query need to select?

Maybe the pages have been moved by third party add-ons? In some cases theses add-ons do not throw page events and projectdoc does not get noticed. In this case the properties may not have been updated. You could check the actual properties of the pages by the use of the Display All Document Properties Macro. Maybe the artificial Page ID property is out of sync? Just in case: Documentation for cache clearing is found in Cache Refresh Actions.

And while I'm clutching at straws ... sad: The page ID of your first example is a prefix of your second. Is the '2' just missing or are pages with a common Page ID prefix involved? In this case the exact match syntax could help ($<Page ID>:[41451685]).

Here are some examples in storage format we tested (and did not reveal the problem). Maybe you could point to the fault in our setup?

&lt;ac:structured-macro ac:name="projectdoc-display-table"&gt;
  &lt;ac:parameter ac:name="doctype"&gt;topic&lt;/ac:parameter&gt;
  &lt;ac:parameter ac:name="where"&gt;DirectAncestorId=15597571 AND -PageID:15597579&lt;/ac:parameter&gt;
  &lt;ac:parameter ac:name="exclude-self"&gt;false&lt;/ac:parameter&gt;
&lt;/ac:structured-macro&gt;

 

&lt;ac:structured-macro ac:name="projectdoc-display-table"&gt;
        &lt;ac:parameter ac:name="doctype"&gt;topic&lt;/ac:parameter&gt;
        &lt;ac:parameter ac:name="where"&gt;DirectAncestorId=15597571 NOT PageID=15597579&lt;/ac:parameter&gt;
        &lt;ac:parameter ac:name="exclude-self"&gt;false&lt;/ac:parameter&gt;
      &lt;/ac:structured-macro&gt;

 

 

Just another observation: I suppose that

DirectAncestorId:50758072  AND -PageID:50758072

should have the same result as

DirectAncestorId:50758072

Since no page should be the direct ancestor of itself. Therefore there should be no need to exclude the page from the list ...

Or am I missing here something?

Robert, you're right and I'm wrong. The second query doesn't return any results, meanwhile "NOT PageID=50758072" (sorry, the last 2 was removed by copy/paste) returns several documents.

I've tried to retrieve subordinates UserCharacters from a UserCharacter parent. The macro shows all subordinates UserCharacters and the self UserCharacter parent. But this occurs with whatever document type.

When I use DisplayMacro, always retrieves the self document, no matter Exclude-Sefl option is checked or not. For example, subordinates UserStory also shows the UserStory parent, even if Exclude-Sef is true.

I 've cleared all caches and the issue persists. 

Also, If I put "Exclude-Self" and "Restrict to inmediate Children" to false and I write "DirectAncestorId:50758087  AND -PageID:50758087" it shows the self document.

So I'm afraid I have still no clue ... sad

May I ask you for the following:

  1. The macro in XML (storage format: <ac:structured-macro ...) so that I can see all parameters and therefore can rule out that I make invalid assumptions
  2. A table with the Page ID and DirectAncestorId information for the involved pages (using e.g. the Display All Document Properties Macro)
  3. List of pages (page IDs) in the result set of the Display Table Macro

I'm very sorry for this inconvenience, but I still cannot reproduce the problem ...

And just in case ... if you add

NOT PageID=50758087

to the WHERE field (without anything else) it is the same as

PageID=50758087

The stopword "NOT" is simply removed. This is because Lucene requires to have a positive selection before a negative one is allowed. But this does not explain why checking the Exclude Self option has no effect ...

Does the following have the same (unwanted) result in your configuration?

Doctype:user-character AND -PageID:50758087

(or 50758072 instead of 50758087)

At last, I use Luke to see the Confluence index and I notice that DirectAncestorId and ParentID aren't indexed although they are stored.

Using Luke search tab I cannot retrieve any results for "PageID:507580872" or "DirectAncestorID:507580872".

PageID_no_term.jpgDirectAncestorID_no_term.jpg

I clear caché, reindex the content and anything works

 

Thank you for the update!

The Page ID has been introduced with version 1.5 (28th March 2015). Prior to this the identifier has been stored by the key ID. Maybe the page has been created with an older version? Evidence is that after a reindex the queries - as you reported - are working.

The problem seems to be that we did not clearly state in the release notes that a reindex is required. We'll track this issue more carefully in the future.

Finally, I found the problem. The indexing Language (in General Configuration) was selected "Other" from the dropdown list. I changed to English and reindexed the content. 

Now, Display Table Macro works as expected!!! 

 

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 24, 2018 in Confluence

Atlassian Research opportunity with Confluence templates

Do you use templates with Confluence? Take part in a remote 1-hr workshop. You'll receive USD $100 for your time!   We're looking for people to participate in a   remote 1-hr workshop...

1,569 views 26 14
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you