Note that there are some explanatory texts on larger screens.

plurals
  1. POSolr - How to get search result in specific format
    text
    copied!<p>While exploring example for <a href="http://wiki.apache.org/solr/DataImportHandler#Example%3a_Indexing_wikipedia" rel="nofollow">indexing wikipedia data</a> in Solr, how can we get the expected result (i.e. same as data imported)?</p> <p>Is there any process that we can achieve it through configurations not from group query, because I have data which having lots of inner tags. </p> <p>I explored xslt result transformation, but i am looking for json response. </p> <p>imported doc:</p> <pre><code>&lt;page&gt; &lt;title&gt;AccessibleComputing&lt;/title&gt; &lt;ns&gt;0&lt;/ns&gt; &lt;id&gt;10&lt;/id&gt; &lt;redirect title="Computer accessibility" /&gt; &lt;revision&gt; &lt;id&gt;381202555&lt;/id&gt; &lt;parentid&gt;381200179&lt;/parentid&gt; &lt;timestamp&gt;2010-08-26T22:38:36Z&lt;/timestamp&gt; &lt;contributor&gt; &lt;username&gt;OlEnglish&lt;/username&gt; &lt;id&gt;7181920&lt;/id&gt; &lt;/contributor&gt; &lt;/revision&gt; &lt;/page&gt; </code></pre> <p>solrConfig.xml:</p> <pre><code>&lt;dataConfig&gt; &lt;dataSource type="FileDataSource" encoding="UTF-8" /&gt; &lt;document&gt; &lt;entity name="page" processor="XPathEntityProcessor" stream="true" forEach="/mediawiki/page/" url="data/enwiki-20130102-pages-articles.xml" transformer="RegexTransformer,DateFormatTransformer" &gt; &lt;field column="id" xpath="/mediawiki/page/id" /&gt; &lt;field column="title" xpath="/mediawiki/page/title" /&gt; &lt;field column="revision" xpath="/mediawiki/page/revision/id" /&gt; &lt;field column="user" xpath="/mediawiki/page/revision/contributor/username" /&gt; &lt;field column="userId" xpath="/mediawiki/page/revision/contributor/id" /&gt; &lt;field column="text" xpath="/mediawiki/page/revision/text" /&gt; &lt;field column="timestamp" xpath="/mediawiki/page/revision/timestamp" dateTimeFormat="yyyy-MM-dd'T'hh:mm:ss'Z'" /&gt; &lt;field column="$skipDoc" regex="^#REDIRECT .*" replaceWith="true" sourceColName="text"/&gt; &lt;/entity&gt; &lt;/document&gt; &lt;/dataConfig&gt; </code></pre> <p>Response by solr query:</p> <pre><code> "response": { "numFound": 1, "start": 0, "docs": [ { "id": "10", "timestamp": "2010-08-26T17:08:36Z", "revision": 381202555, "titleText": "AccessibleComputing", "userId": 7181920, "user": "OlEnglish" } ] } </code></pre> <p>expected response:</p> <pre><code>"response": { "numFound": 1, "start": 0, "docs": [ { "id": "10", "timestamp": "2010-08-26T17:08:36Z", "revision": 381202555, "titleText": "AccessibleComputing", "contributor": [{ "userId": 7181920, "user": "OlEnglish" }] } ] } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload