Extensis Logo SUPPORT | FORUMS | KNOWLEDGE BASE

Asset Query Term - operatorAnd


#1

Hi

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.

thanks
GOH


#2

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();


#3

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:


                   AND
                 /     \  
              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!


#4

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?

thanks
G

$queryId = $AssetsResults->queryCacheId;


#5

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.


#6

[quote=“Loren Barr”]Hi Gohara,

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

[/quote]

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?


#7

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.

-Loren


#8

Hello,

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

     <queryCacheId>0</queryCacheId>
        <queryTerm>
           <fieldName>Filename</fieldName>
           <operator>equalValue</operator>
           <subqueries/>
           <values>\\43.140.39.61\c\Portfolio\Keith_test Files\C0002.mxf</values>
           <subqueries/>
        </queryTerm>
        <sortOptions>
           <sortFieldName>Filename</sortFieldName>
           <sortOrderAscending>true</sortOrderAscending>
        </sortOptions>

-Fred


#9

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.

Thanks,
-Loren


#10

Hi Loren,

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

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

</S:Body>
</S:Envelope>


#11

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”.


#12

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.

-Fred


#13

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.

-Loren