Share via


Search API returning error, invalid xmlChar value in the

Question

Wednesday, September 21, 2016 5:44 PM

Search API returning error on line 182 at column 1739: xmlParseCharRef: invalid xmlChar value 31 Below is a rendering of the page up to the first error. 

Below is the URL has been used:

https://public.abc123.com/\_api/search/query?querytext=%27LB%27&rowlimit=500&selectproperties=%27URL,Title,ContentType%27&QueryTemplatePropertiesUrl=%27spfile://webroot/queryparametertemplate.xml%27

This happens for certain keywords not and the same keyword returns fine in the search result page. 

Wondering if something to be configured in Queryparametertemplate.xml?

<?xml version="1.0" encoding="UTF-8" ?><QueryPropertiesTemplate xmlns="http://www.microsoft.com/sharepoint/search/KnownTypes/2008/08" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><QueryProperties i:type="KeywordQueryProperties"><EnableStemming>true</EnableStemming><FarmId>81e96073-5575-438e-a177-e62ff85db1a9</FarmId><SiteId>71e41685-c069-4d77-a218-be800e17f81e</SiteId><WebId>d9bde809-a9bf-4120-b8c6-1414e4ec81ff</WebId><IgnoreAllNoiseQuery>true</IgnoreAllNoiseQuery><KeywordInclusion>AllKeywords</KeywordInclusion><SummaryLength>180</SummaryLength><TrimDuplicates>true</TrimDuplicates><WcfTimeout>120000</WcfTimeout><Properties xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"><a:KeyValueOfstringanyType><a:Key>_IsEntSearchLicensed</a:Key><a:Value i:type="b:boolean" xmlns:b="http://www.w3.org/2001/XMLSchema">true</a:Value></a:KeyValueOfstringanyType><a:KeyValueOfstringanyType><a:Key>EnableSorting</a:Key><a:Value i:type="b:boolean" xmlns:b="http://www.w3.org/2001/XMLSchema">true</a:Value></a:KeyValueOfstringanyType><a:KeyValueOfstringanyType><a:Key>MaxKeywordQueryTextLength</a:Key><a:Value i:type="b:int" xmlns:b="http://www.w3.org/2001/XMLSchema">4096</a:Value></a:KeyValueOfstringanyType><a:KeyValueOfstringanyType><a:Key>TryCache</a:Key><a:Value i:type="b:boolean" xmlns:b="http://www.w3.org/2001/XMLSchema">true</a:Value></a:KeyValueOfstringanyType></Properties><PropertiesContractVersion>15.0.0.0</PropertiesContractVersion><EnableFQL>false</EnableFQL><EnableSpellcheck>Suggest</EnableSpellcheck><EnableUrlSmashing>true</EnableUrlSmashing><IsCachable>false</IsCachable><MaxShallowRefinementHits>100</MaxShallowRefinementHits><MaxSummaryLength>185</MaxSummaryLength><MaxUrlLength>2048</MaxUrlLength><SimilarType>None</SimilarType><SortSimilar>true</SortSimilar><TrimDuplicatesIncludeId>0</TrimDuplicatesIncludeId><TrimDuplicatesKeepCount>1</TrimDuplicatesKeepCount></QueryProperties><WhiteList xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"><a:string>RowLimit</a:string><a:string>SortList</a:string><a:string>StartRow</a:string><a:string>RefinementFilters</a:string><a:string>Culture</a:string><a:string>RankingModelId</a:string><a:string>TrimDuplicatesIncludeId</a:string><a:string>ReorderingRules</a:string><a:string>EnableQueryRules</a:string><a:string>HiddenConstraints</a:string><a:string>QueryText</a:string><a:string>QueryTemplate</a:string><a:string>SelectProperties</a:string><a:string>SourceID</a:string></WhiteList></QueryPropertiesTemplate>

Any help on this appreciated. 

Rayudu

All replies (2)

Thursday, September 22, 2016 7:07 AM ✅Answered

Hi Rayudu,

To enable anonymous Search REST queries, we need to create queryparametertemplate.xml and upload it to the correct library in SharePoint.

From your description I can know that you have created the file, then I recommend to check the things below:

  1. Make sure that the Query Properties you need have been added to the QueryProperties element in the queryparametertemplate.xml file.
  2. Make sure that the query parameters you need have been added to the WhiteList element in the queryparametertemplate.xml file.
  3. Make sure that you have add the QueryTemplatePropertiesUrl parameter and file location to your search Rest call.

For more detailed information, refer to the following article:

http://www.eliostruyf.com/search-javascript-calls-not-working-for-anonymous-users-and-how-to-fix-it/

Besides, when the Limited-access user permission lockdown mode feature is enabled, permissions for users with “limited access” permissions, such as Anonymous Users, are reduced. So make sure the "Limited-access user permission lockdown mode feature" is not enabled.

Best Regards,

Lisa Chen

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
If you have feedback for TechNet Subscriber Support, contact [email protected]


Friday, June 15, 2018 10:16 PM

I was running into this error and i found a post that mentioned the result set might be too long. I had my rowlimit set at 100. Bumping it down to 20 eliminated the error. You can probably play with the results to see what size works best for you.