I'm calling ISQuery on a search that returns several thousand hits. I'm trying to page through them in batches of 1000.
My initial call, in which I'm trying to get results 0-999, looks like this:
<?xml version="1.0" encoding="utf-8"?><AXFRoot> <MAObject type="default" mdclass="DMQuery"> <GUID>f792fcf0-ddd2-4ee4-98b1-e75cad41e23e</GUID> <Meta name="USER" format="string">...</Meta> <Meta name="ACCESSKEY" format="string">...</Meta> <Meta name="HITLISTID" format="string">01 - Default</Meta> <Meta name="MAXHITS" format="string">1000</Meta> <Meta name="FIRSTHIT" format="string">0</Meta> <Meta name="LASTHIT" format="string">999</Meta> <Meta name="RESULTID" format="string">ed8c09b4-46e7-470d-a190-9796affc7a07</Meta> </MAObject></AXFRoot>
...which works fine. The response indicates NUMBEROFHITS=94184 and FIRSTHIT=0.
The next call, in which I'm trying to get results 1000-1999, does not:
<?xml version="1.0" encoding="utf-8"?><AXFRoot> <MAObject type="default" mdclass="DMQuery"> <GUID>f792fcf0-ddd2-4ee4-98b1-e75cad41e23e</GUID> <Meta name="USER" format="string">...</Meta> <Meta name="ACCESSKEY" format="string">...</Meta> <Meta name="HITLISTID" format="string">01 - Default</Meta> <Meta name="MAXHITS" format="string">1000</Meta> <Meta name="FIRSTHIT" format="string">1000</Meta> <Meta name="LASTHIT" format="string">1999</Meta> <Meta name="RESULTID" format="string">ed8c09b4-46e7-470d-a190-9796affc7a07</Meta> </MAObject></AXFRoot>
The error I get says "ma.macommon.MASoapClientException: Client.IntegrationServiceWS.InternalError - DataManagerWS.DMException.IllegalSearchSyntax: Client.DataManagerWS.IllegalSearchSyntax - illegal search syntax: invalid hit range".
What am I doing wrong?
The ISQuery method expects the query format as defined in the Search Syntax documentation and that documentation is the reference. The Integration Service documentation contains only a brief overview. However, the Search Syntax documentation is also not very detailed when it comes to hitlist paging. We should improve that in the next release. Here's a better example:
- The first page shows the first 25 hits: FIRSTHIT=0, MAXHITS=25
- The second page shows the next 25 hits: FIRSTHIT=25, MAXHITS=50
- Third page: FIRSTHIT=50, MAXHITS=75
- and so on
So, in your query for the second page, the MAXHITS value should be 2000 instead of 1000. The idea is that MAM fetches 2000 hits (MAXHITS=2000) and returns only those starting with index 1000 (FIRSTHIT=1000) of those. The next page would have FIRSTHIT=2000, MAXHITS=3000, and so on.
The LASTHIT tag that is mentioned in the Integration Service documentation is outdated and not used anymore, actually because it was rather confusing .
By the way: In Interplay | MAM 5, we introduced a new XML query format that is easier to use and read. The format is explained in the chapter "XML query format" in the Search Syntax reference.
Thanks so much for the clarification! I'm back in business.
Regarding the XML query format... I have customers on versions 4 and 5, so I believe I'll want to stick with the AXF format. Do you anticipate deprecating the AXF format in the future?
No, currently there are no plans to deprecate the AXF query format. The format is used at least in a number of components within Interplay | MAM, in custom SWoDL scripts, and in the Integration Service. Removing the AXF query format would be a regression and we don't do that light-heartedly.
© Copyright 2011 Avid Technology, Inc. Terms of Use | Privacy Policy | Site Map | Find a Reseller