/** * This indexes something that implements Mixin_ElementText into a Solr Document. * * @param array $fields The fields to index. * @param Mixin_ElementText $item The item containing the element texts. * @param Apache_Solr_Document $doc The document to index everything into. * @return void * @author Eric Rochester <*****@*****.**> **/ public static function indexItem($fields, $item, $doc) { foreach ($item->getAllElementTexts() as $text) { $field = $fields->findByText($text); // Set text field. if ($field->is_indexed) { $doc->setMultiValue($field->indexKey(), $text->text); } // Set string field. if ($field->is_facet) { $doc->setMultiValue($field->facetKey(), $text->text); } } }
/** * This indexes something that implements Mixin_ElementText into a Solr Document. * * @param array $fields The fields to index. * @param Mixin_ElementText $item The item containing the element texts. * @param Apache_Solr_Document $doc The document to index everything into. * @return void * @author Eric Rochester <*****@*****.**> **/ public static function indexItem($fields, $item, $doc) { foreach ($item->getAllElementTexts() as $text) { $field = $fields->findByText($text); // MAKE SURE EVERYTHING IS INDEXED! AND THAT ALL DATA IS FACETED, BUT NOT SHOWN AS A FACET if ($field->element_id == '39') { if (self::get_elements_private_status_by_value($text->text, "Title", 4)) { // _log("ANONIMOUS VERTELLER: " . $text->text); $doc->setMultiValue($field->indexKey(), "anoniem"); //anonymous for public $doc->setMultiValue($field->facetKey(), "anoniem"); $doc->setMultiValue($field->indexKey() . "_admin", $text->text); $doc->setMultiValue($field->facetKey() . "_admin", $text->text); } else { $doc->setMultiValue($field->indexKey(), $text->text); $doc->setMultiValue($field->facetKey(), $text->text); $doc->setMultiValue($field->indexKey() . "_admin", $text->text); $doc->setMultiValue($field->facetKey() . "_admin", $text->text); } } elseif ($field->element_id == '60') { if (self::get_elements_private_status_by_value($text->text, "Title", 9) || self::get_elements_private_status_by_value($text->text, "Title", 4)) { // _log("ANONIMOUS VERZAMELAAR: " . $text->text); $doc->setMultiValue($field->indexKey(), "anoniem"); //anonymous for public $doc->setMultiValue($field->facetKey(), "anoniem"); $doc->setMultiValue($field->indexKey() . "_admin", $text->text); $doc->setMultiValue($field->facetKey() . "_admin", $text->text); } else { $doc->setMultiValue($field->indexKey(), $text->text); $doc->setMultiValue($field->facetKey(), $text->text); $doc->setMultiValue($field->indexKey() . "_admin", $text->text); $doc->setMultiValue($field->facetKey() . "_admin", $text->text); } } else { //if there are no special privacy problems: // Set text field. if ($field->is_indexed) { $doc->setMultiValue($field->indexKey(), $text->text); } // Set string field. // ADJUST: MAKE AN EXTRA SETTING FOR SHOWING FACETS IN SEQUENCE ->SET ALL TO IS_FACET if ($field->is_facet) { $doc->setMultiValue($field->facetKey(), $text->text); } } } }