Asset Query Term - operatorAnd



I am trying to query the Portfolio API on multiple fields using “operatorAnd” but the results are more like an “or” query. Any advice would be appreciated.

Passing this query -
Object ( [fieldName] => [operator] => operatorAnd [subqueries] => Array ( [0] => assetQueryTerm Object ( [fieldName] => MuseumPlus_PublishRecord [operator] => equalValue [subqueries] => Array ( ) [values] => Yes ) [1] => assetQueryTerm Object ( [fieldName] => MuseumPlus_Keywords [operator] => containsValue [subqueries] => Array ( ) [values] => Array ( [0] => bowls ) ) [2] => assetQueryTerm Object ( [fieldName] => MuseumPlus_ObjectName [operator] => containsValue [subqueries] => Array ( ) [values] => Array ( [0] => sketch ) ) ) [values] => Array ( ) )

Gives results only for “bowls” in the MuseumPlus_Keywords and not “sketch” from MuseumPlus_ObjectName.



It would appear to me that the API only accepts 2 sub queries at a time although the documentation suggest 3 or more can be used:

$aQuery = new AssetQuery();

$qTermOr = new AssetQueryTerm();
$qTermAnd = new AssetQueryTerm();
$qTermA = new AssetQueryTerm();
$qTermB = new AssetQueryTerm();
$qTermC = new AssetQueryTerm();


Hi Gohara,

It looks like we may have broken multi-subquery support in 1.0. I will file a bug.

In the meantime, you should be able to accomplish what you want using the following query structure:

                 /     \  
              TermA     AND
                      /     \
	               TermB      AND
                           /     \
                       TermC     TermD

Please let us know if that works for you, or if you have any questions about how to do this. Thanks!


Hi Loren,

thanks, building up subqueries works in this fashion.

I am now trying to page through results. The documentation talks about the query cache ID but this is returning "no longer used’. Can you tell me how we are recommended to page the results?


$queryId = $AssetsResults->queryCacheId;


Yes, we no longer need the query cache mechanism, due to the high performance of our new back end.

To page, simply reissue the same query with updated values for startingIndex, and optionally pageSize, in the assetQueryResultOptions object.


[quote=“Loren Barr”]Hi Gohara,

It looks like we may have broken multi-subquery support in 1.0. I will file a bug.


Is this still broken? I am also trying a queryTermAND operation with 3 terms (as per the documentation) and it is only seeing the first two. Is there a new release (or a patch) available for the api?


Hi Gohara,

Unfortunately that bug has not been fixed yet. You’ll have to use a binary tree approach, as described and diagrammed in my previous post.




I am trying to call getAssets using SoapUI and I also am receiving the “no longer used” error.

Is this still broken? What is the workaround when using SoapUI? Here is my queryCacheId input below

           <values>\\\c\Portfolio\Keith_test Files\C0002.mxf</values>



Hi Fred,

The message about queryCacheId no longer being used is not an error, just an explanation. Looks to me like you are searching for an asset by filename, but supplying a path to the file. Try just using the filename itself.

Also, feel free to post the entire result message and we can see if there are other issues you’re running into.



Hi Loren,

I tried using just the file name. Here’s the response I received.

  <ns2:getAssetsResponse xmlns:ns2="http://portfolio.extensis/service/asset">
        <queryCacheId>no longer used</queryCacheId>



OK, so that is not an error, it’s just saying 0 assets were found with that query. Triple check that the asset with the file name is in the catalog you expect, and that you are sending the right catalog id and file name to the query.

You could also sanity-check by issuing a more broad query and make sure you get back expected results. For instance, you could query for assets whose Filename exists, or start with “C”.


Hi Loren,

The Soap query is working now. Using “C” by itself did not work, however if I supplied the whole filename of C0009.mxf (and not the full path) that returned the expected results.

Thanks for your help, I’m good to go now.



Thanks for the update Fred, that’s great to hear. Let us know if you run into any more mysteries and we’ll get you sorted.