Hello list, I have recently been working on some JS (ajax solr) and when using Firebug I am alerted to an error within the JS file as below. It immediately breaks on line 12 stating that 'doc.text' is undefined! Here is the code snippet.
10 AjaxSolr.theme.prototype.snippet = function (doc) { 11 var output = ''; 12 if (doc.text.length > 300) { 13 output += doc.dateline + ' ' + doc.text.substring(0, 300); 14 output += '<span style="display:none;">' + doc.text.substring(300); 15 output += '</span> <a href="#" class="more">more</a>'; 16 } 17 else { 18 output += doc.dateline + ' ' + doc.text; 19 } 20 return output; 21 }; I have been advised that the problem might stem from my schema not defining a text field, however as my implementation of Solr is currently geared to index docs from a Nutch web crawl I am using the Nutch schema. A snippet of the schema is below <schema name="nutch" version="1.1"> <types> ... <fieldType name="text" class="solr.TextField" positionIncrementGap="100"> <analyzer> ... </types> <fields> ... <field name="content" type="text" stored="true" indexed="true"/> </fields> </schema> Can someone confirm if I require to add something similar to the following <fields> ... <field name="text" type="text" stored="true" indexed="true"/> </fields> Then perform a fresh crawl and reindex so that the schema field is recognised by the JS snippet? Also (sorry I apologise) from my reading on the Solr schema, I became intrigued in options for TextField... namely compressed and compressThreshold. I understand that they are used hand in glove, however can anyone please explain what benefits compression adds and what integer value should be appropriate for the latter option. Any help would be great Thank you Lewis Glasgow Caledonian University is a registered Scottish charity, number SC021474 Winner: Times Higher Education’s Widening Participation Initiative of the Year 2009 and Herald Society’s Education Initiative of the Year 2009. http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,6219,en.html Winner: Times Higher Education’s Outstanding Support for Early Career Researchers of the Year 2010, GCU as a lead with Universities Scotland partners. http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,15691,en.html