3 Replies Latest reply on Apr 24, 2017 1:17 PM by felczantom

    PI WebAPI search controller

    felczantom

      Hello, I want to use search feature provided by WebAPI Search controller.

      For example on a PI Data Archive  are available points named "SINUSOID" and "SINUSOID Test" .

      Now I would search only name SINUSOID.

      I put this URL: https://our_server/piwebapi/search/query?q=sinusoid

       

      But the controller returns both names "SINUSOID" and "SINUSOID Test" (attachment enclosed).

      Is there any method to get just searched point name?

       

      Thanks for your reply in advance.

        • Re: PI WebAPI search controller
          gregor

          Hello Thomas,

           

          Please see Ajey Achutha's replies in this other thread.

          Because the exact match will always be the result with the highest rank you could expect SINUSOID in first place and either pick the required information from the first result or avoid additional results from being returned by adding &count=1 to your query.

          • Re: PI WebAPI search controller
            Marcos Vainer Loeff

            Hi Tomas,

             

            On top of what Gregor has suggested, if you already know the PI Point name, why don't you use GetByPath method from the Points controller instead?

             

            You can also get a list of the dataServers available through this method.

             

            Hope it helps!

              • Re: PI WebAPI search controller
                felczantom

                Thank you, but my webapi client doesn't know exact point name.

                I would make some  c#  method like below, so caller pass SINUSOID string without count parameter (or default 100) and if it exists then I get only 1 result, if not then nothing.

                But now I get two results.

                 

                 

                public InstanceInfoList PI_GetPoints(string piServerName,string filterValue)

                {

                            InstanceInfoList iil = (InstanceInfoList)CallWebAsync<InstanceInfoList>($"search/query?q=name:{filterValue}&scope=pi:{piServerName}&count=100&fields=name;webid;description");

                            return iil;

                }

                 

                But OK, I can accept just first one record (maximum scorred)

                Thank you all !