Getting no results from the SOAP AdvancedSearch function


(Nic Hubbard) #1

I am having trouble getting any results from the AdvancedSearch SOAP function. I am using the newer IncludeAll field option, which our WSDL file correctly has in it. Here is what I am sending to the server:



<br /> &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;<br /> &lt;soap:Envelope xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:ns1=&quot;http://www.mysite.com/web/soap&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:soap=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;<br /> &lt;soap:Body&gt;<br /> &lt;ns1:AdvancedSearch&gt;<br /> &lt;FieldLogic&gt;AND&lt;/FieldLogic&gt;<br /> &lt;Limit&gt;100&lt;/Limit&gt;<br /> &lt;ResultFormat&gt;%asset_name%&lt;/ResultFormat&gt;<br /> &lt;RootIDs&gt;1&lt;/RootIDs&gt;<br /> &lt;RootLogic&gt;OR&lt;/RootLogic&gt;<br /> &lt;Statuses&gt;1&lt;/Statuses&gt;<br /> &lt;Statuses&gt;2&lt;/Statuses&gt;<br /> &lt;Statuses&gt;4&lt;/Statuses&gt;<br /> &lt;Statuses&gt;8&lt;/Statuses&gt;<br /> &lt;Statuses&gt;16&lt;/Statuses&gt;<br /> &lt;Statuses&gt;32&lt;/Statuses&gt;<br /> &lt;Statuses&gt;64&lt;/Statuses&gt;<br /> &lt;Statuses&gt;128&lt;/Statuses&gt;<br /> &lt;Statuses&gt;256&lt;/Statuses&gt;<br /> &lt;ExcludeRootNodes&gt;0&lt;/ExcludeRootNodes&gt;<br /> &lt;SearchFields&gt;<br /> &lt;SearchTerm&gt;<br /> &lt;&#33;[CDATA[college]]&gt;<br /> &lt;/SearchTerm&gt;<br /> &lt;WordLogic&gt;OR&lt;/WordLogic&gt;<br /> &lt;DataSources&gt;<br /> &lt;FieldType&gt;IncludeAll&lt;/FieldType&gt;<br /> &lt;StandardOption /&gt;<br /> &lt;/DataSources&gt;<br /> &lt;/SearchFields&gt;<br /> &lt;/ns1:AdvancedSearch&gt;<br /> &lt;/soap:Body&gt;<br /> &lt;/soap:Envelope&gt;



And I just get back an empty ns1:AdvancedSearchResponse.



Have I missed something important in the request? Seems like everything I try returns nothing.



Any help?


(Nic Hubbard) #2

Has no one used this before?


(Benjamin Pearson) #3

There is a unit test for this function, so it should be working. Have you tried running the same search in a search page and see if the results are correct (maybe indexing is incorrect)? If they are not, then are you getting any errors in the error log? The only other thing I can think of is the XML is slightly incorrect but I don't see anything visually wrong with it.


(Nic Hubbard) #4

[quote]
There is a unit test for this function, so it should be working. Have you tried running the same search in a search page and see if the results are correct (maybe indexing is incorrect)? If they are not, then are you getting any errors in the error log? The only other thing I can think of is the XML is slightly incorrect but I don't see anything visually wrong with it.

[/quote]



Yes, I have tested a Search Page with similar settings. No errors in the logs. What XML issues do you see?


(Edison Wang) #5

I found if you use root node 1, it won't return results. But if you use 0, or just don't specify the root node, it works properly.
Here is my working soap request:



<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://whiskey.labs.squiz.net.au/ewang_dev/_web_services/soap-server">

<soapenv:Header/>

<soapenv:Body>

<soap:AdvancedSearch>

<FieldLogic>AND</FieldLogic>

<Limit>10</Limit>

<!–Optional:–>



<RootIDs>0</RootIDs>

<RootLogic>OR</RootLogic>

<Statuses>1</Statuses>

<Statuses>2</Statuses>

<Statuses>4</Statuses>

<Statuses>8</Statuses>

<Statuses>16</Statuses>

<Statuses>32</Statuses>

<Statuses>64</Statuses>

<Statuses>128</Statuses>

<Statuses>256</Statuses>





<SearchFields>

<SearchTerm>animal</SearchTerm>

<WordLogic>OR</WordLogic>

<!–Zero or more repetitions:–>

<DataSources>

<FieldType>IncludeAll</FieldType>



</DataSources>

</SearchFields>

</soap:AdvancedSearch>

</soapenv:Body>

</soapenv:Envelope>


(Nic Hubbard) #6

[quote]
I found if you use root node 1, it won't return results. But if you use 0, or just don't specify the root node, it works properly.

[/quote]



You are awesome. Using 0 for the root node worked. Really appreciate you helping!