Searching for value based on partial string

Searching for an event frame based on Attribute Value is very useful. I am interested in knowing whether it can be used to search on String values, using only partial strings.

 

This article is quite useful:

https://pisquare.osisoft.com/s/Blog-Detail/a8r1I000000Gv9KQAS/coding-tips-for-using-the-afsearch-in-operator?t=1726547940087

 

But in it it explains that the "In" operator is used for searching for a string value that is in a list of pre-defined values. Does this mean that it can't use wildcard or other pattern matching?

 

I tried it in my own sample code, and it didn't work.

AFSearchValueToken textToken = new AFSearchValueToken("|TEXT_ATTRIBUTE", "*Hello*", AFSearchOperator.In);

I can always load all the AFEventFrames (eg. filter by template first), and then find the matching ones using Linq, but I was hoping for a server-side search.

 

Parents
  • Hi Andrew,

     

    I was the author of that referenced blog back when I was an OSIsoft employee. One restriction on IN that perhaps wasn't emphasized enough: IN only works with EXACT values, though for strings I think case-insensitive match is okay. So it cannot be used for partial strings or use wildcards.

     

    I would suggest your 2 areas of concern should be: (1) getting the right answer, and (2) getting that answer in a performant way.

     

    One issue with an AFAttributeSearch is that it does require a full load of all base elements into memory. Typically to review attribute values requires a sluggish client-side search.

    Note an event frame is a base element. The good news is that if your event frames are closed, i.e. have a EndTIme set, then with captured values you could possibly have the search occur server-side. But again, it is the partial strings that will cause performance issues.

     

     

  • Thanks. Yes - it is searching closed EventFrames. I think I will filter the list as much as possible server-side, then use Linq to do the text search client-side.

Reply Children
No Data