Vishesh
Vishesh

Reputation: 21

Issue with the Google search appliance Feed

I am trying to feed a xml file to google search appliance with some JSON data in <![CDATA[ ]]> tag, but not getting the expected result because GSA is rendering as HTML format.

Below is the file I am trying to feed on GSA-

<?xml version='1.0' encoding='UTF-8'?><!DOCTYPE gsafeed PUBLIC "-//Google//DTD GSA Feeds//EN" "gsafeed.dtd">
<gsafeed>
<header>
<datasource>samples_feed</datasource>
<feedtype>Full</feedtype>
</header>
<group>
<record url="some url" action="add" mimetype="application/json"> 
<content>
 <![CDATA[
{"1":"Samlpe","2":"JSON","3":false}]]> 
</content>
</record>
</group>
</gsafeed>

Upvotes: 0

Views: 119

Answers (2)

Siddharth Patil
Siddharth Patil

Reputation: 43

With way the record content is formatted, you'll certainly be able to get the GSA to index the content, but you'll just not be able to get back the JSON data as part of the results. To do that, you'll need to [encode and] embed that in to the content of a metadata tag. For e.g.,

    <content>
    <![CDATA[
    <head>
    <meta name="jsondata" content='{"1":"Samlpe","2":"JSON","3":false}'>
    </head><body></body>
    </html>
    ]]> 
    </content>

Then when you actually make a search (for which you expect the above record to match), pass in a "&getfields=jsondata" or "getfields=*" in the query string -- with this you should be able to see your result which includes the json data in an element in something like as below:

    <MT N="jsondata" V="{'your': 'json', 'data': 'here'}">

Upvotes: 1

Michael Cizmar
Michael Cizmar

Reputation: 462

The GSA is indexing the content of your CDATA as plain text. Regardless of content type and mimetype, all content sent to the GSA is indexed the same way. It's converted to HTML and then indexed. If you want structured content in your results, use metadata that's included in the feed protocol or create an html document with html metadata.

Upvotes: 0

Related Questions