2 of 2 people found this helpful
Thanks for posting your problem here at PI Developers Club. I think you must have changed something in your code, or perhaps you are remembering it differently, but the fact is that TemplateName does not nor has not support the IN search operator.
Here is what the Search Overview shows for PI AF 2018 (AF SDK 2.10)
For it to support the IN operator, I would expect something to show like:
Okay, so the very latest release does not support the EqualOrInOperator for TemplateName. What about the previous release, PI AF 2017 R2 (AF SDK 2.9.5)? Search Overview shows:
Clearly this shows that for TemplateName, you cannot and could not have used the IN operator. You may use the IN operator on Element in older versions, and now ID with 2.10. There is a blog on coding tips with the IN operator that you may find helpful, although that is geared more towards filtering on attribute values. And the Search Overview page is always a great bookmarked page.
Even if TemplateName supported the IN operator, your code would not work because your path is incorrect. The snippet db.Elements[BUILDING].GetPath() returns a path to one element down the path db.Elements, which could not be the same path as element templates down the path of db.ElementTemplates.
Finally, not that there is any indication with what you've shown, but a given search capability will only allowed by the minimum of AF Server versus AF Client versions. If your client is AF SDK 2.10, but the server is 2.9.5, then your search will be a 2.9.5 search.
There was an issue fixed where the server did not report an error if it did not support an operator and would just ignore that part of the query. That is probably what you were seeing and did not realize that it was being ignored by the search.