@@ -303,10 +303,10 @@ discard block |
||
303 | 303 | |
304 | 304 | |
305 | 305 | /** |
306 | - * Get an elasticsearch document |
|
307 | - * |
|
308 | - * @return \Elastica\Document |
|
309 | - */ |
|
306 | + * Get an elasticsearch document |
|
307 | + * |
|
308 | + * @return \Elastica\Document |
|
309 | + */ |
|
310 | 310 | public function getElasticaDocument() { |
311 | 311 | self::$index_ctr++; |
312 | 312 | $fields = $this->getFieldValuesAsArray(); |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | } |
703 | 703 | |
704 | 704 | |
705 | - public function updateCMSFields(\FieldList $fields) { |
|
705 | + public function updateCMSFields(\FieldList $fields) { |
|
706 | 706 | $isIndexed = false; |
707 | 707 | // SIteTree object must have a live record, ShowInSearch = true |
708 | 708 | if ($this->isInSiteTree($this->owner->ClassName)) { |
@@ -727,45 +727,45 @@ discard block |
||
727 | 727 | $terms = new \ArrayList(); |
728 | 728 | |
729 | 729 | foreach (array_keys($termVectors[$field]['terms']) as $term) { |
730 | - $do = new \DataObject(); |
|
731 | - $do->Term = $term; |
|
732 | - $stats = $termVectors[$field]['terms'][$term]; |
|
733 | - if (isset($stats['ttf'])) { |
|
734 | - $do->TTF = $stats['ttf']; |
|
735 | - } |
|
736 | - |
|
737 | - if (isset($stats['doc_freq'])) { |
|
738 | - $do->DocFreq = $stats['doc_freq']; |
|
739 | - } |
|
740 | - |
|
741 | - if (isset($stats['term_freq'])) { |
|
742 | - $do->TermFreq = $stats['term_freq']; |
|
743 | - } |
|
744 | - $terms->push($do); |
|
745 | - } |
|
746 | - |
|
747 | - $config = \GridFieldConfig_RecordViewer::create(100); |
|
730 | + $do = new \DataObject(); |
|
731 | + $do->Term = $term; |
|
732 | + $stats = $termVectors[$field]['terms'][$term]; |
|
733 | + if (isset($stats['ttf'])) { |
|
734 | + $do->TTF = $stats['ttf']; |
|
735 | + } |
|
736 | + |
|
737 | + if (isset($stats['doc_freq'])) { |
|
738 | + $do->DocFreq = $stats['doc_freq']; |
|
739 | + } |
|
740 | + |
|
741 | + if (isset($stats['term_freq'])) { |
|
742 | + $do->TermFreq = $stats['term_freq']; |
|
743 | + } |
|
744 | + $terms->push($do); |
|
745 | + } |
|
746 | + |
|
747 | + $config = \GridFieldConfig_RecordViewer::create(100); |
|
748 | 748 | $config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array( |
749 | - 'Term' => 'Term', |
|
750 | - 'TTF' => 'Total term frequency (how often a term occurs in all documents)', |
|
751 | - 'DocFreq' => 'n documents with this term', |
|
752 | - 'TermFreq'=> 'n times this term appears in this field' |
|
753 | - )); |
|
754 | - |
|
755 | - $underscored = str_replace('.', '_', $field); |
|
756 | - |
|
757 | - $gridField = new \GridField( |
|
758 | - 'TermsFor'.$underscored, // Field name |
|
759 | - $field.'TITLE'.$field, // Field title |
|
760 | - $terms, |
|
761 | - $config |
|
762 | - ); |
|
763 | - $fields->addFieldToTab('Root.ElasticaTerms.'.$underscored, $gridField); |
|
749 | + 'Term' => 'Term', |
|
750 | + 'TTF' => 'Total term frequency (how often a term occurs in all documents)', |
|
751 | + 'DocFreq' => 'n documents with this term', |
|
752 | + 'TermFreq'=> 'n times this term appears in this field' |
|
753 | + )); |
|
754 | + |
|
755 | + $underscored = str_replace('.', '_', $field); |
|
756 | + |
|
757 | + $gridField = new \GridField( |
|
758 | + 'TermsFor'.$underscored, // Field name |
|
759 | + $field.'TITLE'.$field, // Field title |
|
760 | + $terms, |
|
761 | + $config |
|
762 | + ); |
|
763 | + $fields->addFieldToTab('Root.ElasticaTerms.'.$underscored, $gridField); |
|
764 | 764 | } |
765 | 765 | |
766 | 766 | } |
767 | 767 | |
768 | - return $fields; |
|
768 | + return $fields; |
|
769 | 769 | } |
770 | 770 | |
771 | 771 |