AnsweredAssumed Answered

AFSearchToken AFSearchFilter.Category NotEqual - Not working as expected

Question asked by Jagan on Nov 13, 2018
Latest reply on Nov 13, 2018 by Rick Davin

Hi,

 

During element search using tokens, I wish to exclude elements that some specific category.

To do that, I tried this line

   tokens.Add(new AFSearchToken(AFSearchFilter.Category, AFSearchOperator.NotEqual, excludeCategory.GetPath()));

Meaning that returned element should not have that category.

But it doesn't work as I wanted. Instead the search result is: All the elements that have that excludeCategory are returned.  Any comments on what's wrong?

 

           var tokens = new List<AFSearchToken>
            {
                new AFSearchToken(AFSearchFilter.Template, AFSearchOperator.Equal, elementTemplate.GetPath())
            };
            if (null != excludeElementCategory)
            {
                // TODO: The AFSearchOperator.NotEqual is not working as expected, not suer why, need to recheck this after upgrading AF Versions
                //Logger.Info($"{log}Search will ingore UI Hidden elements");
                //tokens.Add(new AFSearchToken(AFSearchFilter.Category, AFSearchOperator.NotEqual, excludeCategory.GetPath()));
            }

 

Thanks,

Jagan

Outcomes