Search query syntax


#1

What is the syntax for the query string used by Search – actual code examples would be great. My code is generating a null result with the code below. The query string is right out of the XML2 documentation.


<cfscript>
    stAuth = structNew();
    stAuth.username = "gruner";
    stAuth.password = "3a96...a72a";
    ws = createObject("webservice", "http://flightxml.flightaware.com/soap/FlightXML2/wsdl", stAuth);

    stSearch = structNew();
    stSearch.query = "{aircraftType {B76* B77*}}";
    stSearch.howMany = 15;
    stSearch.offset = 0;

    aSearchStruct = ws.search(stSearch);
</cfscript>

<cfset searchFlights="#aSearchStruct.getSearchResult().getAircraft()#">

<cfloop from="1" to="#ArrayLen(searchFlights)#" index="i">
    <cfoutput>#searchFlights*.ident#<br></cfoutput>
</cfloop>


#2

The query syntax for “Search” is different than for “SearchBirdseyeInFlight”. The query syntax you’re using is intended for SearchBirdseyeInFlight, which supports a more complex query language than Search.

If you really want to use Search, then you must use “-type {B76* B77*}” as the query.


#3

Thanks for the quick response. Fixed the problem.

I think we coders need to take care with these parameters as I notice they are often different across methods such as dest & destination, type & aircraftType.