Doc.text.length

79 views
Skip to first unread message

Sidd

unread,
Jun 27, 2012, 11:03:05 AM6/27/12
to ajax...@googlegroups.com
Hello again. I have a different, smaller problem.

In the reuters.theme.js file, it was checked to see if doc.text.length > 300 so it knows whether it should cut it off and add a 'more' link if the user wants to see the whole thing. However, for some reason with my Solr server, it turns out that doc.text.length is always equal to 1 for my text. Whenever I print out doc.text however, the whole text prints out like it should (with well over 300 characters). Anyone have any idea about this?

Sidd

James McKinney

unread,
Jun 27, 2012, 11:04:52 AM6/27/12
to ajax...@googlegroups.com
Maybe doc.text is an array, so you need to do doc.text[0].length ?

junte zhang

unread,
Jun 27, 2012, 11:06:43 AM6/27/12
to ajax...@googlegroups.com
This is a JQuery thing.
Try to make it a String first.

var textLen = String(doc.text).length;

Cheers,
junte

Sidd

unread,
Jun 27, 2012, 11:07:25 AM6/27/12
to ajax...@googlegroups.com
Right...didn't think about that, but that did the trick. Thanks!

A

unread,
Feb 7, 2019, 3:07:37 PM2/7/19
to ajax-solr
another solution would be to change your solr schema so that the field was not an array if it wasnt meant to be
Reply all
Reply to author
Forward
0 new messages