while ($data = $instance->indexerGetData()) {
                // Results can be packed in an array of array('resultset' => $results)
                // or can be returned one by one.
                // Every result can be an object or an array.
                // every field will be accessed in object->field or array['field'] manner
                // depending on the result type
                if (is_array($data) && isset($data['resultset']) && count($data['resultset']) > 0) {
                    foreach ($data['resultset'] as $data) {
                        if ($data != null) {
                            indexData($writer, $fields, $data);
                        }
                    }
                } else {
                    if ($data != null && $data !== false) {
                        if ($data != null) {
                            indexData($writer, $fields, $data);
                        }
                    }
                }
            }
            unset($data);
            $writer->optimize();
            $info = new stdClass();
            $info->startDate = $startDate;
            $info->date = date('Y/m/d H:i');
            $info->documentCount = java_values($writer->docCount());
            $writer->close();
            file_put_contents($pluginindex . '.info', json_encode($info));
        }
    }
}
        $index = new Zend_Search_Lucene($pluginindex, true);
        $fields = $instance->indexerGetFields();
        if ($fields) {
            while ($data = $instance->indexerGetData()) {
                // Results can be packed in an array of array('resultset' => $results)
                // or can be returned one by one.
                // Every result can be an object or an array.
                // every field will be accessed in object->field or array['field'] manner
                // depending on the result type
                if (is_array($data) && isset($data['resultset']) && count($data['resultset']) > 0) {
                    foreach ($data['resultset'] as $data) {
                        indexData($index, $fields, $data);
                    }
                } else {
                    if ($data != null && $data !== false) {
                        indexData($index, $fields, $data);
                    }
                }
            }
            $index->optimize();
            $info = new stdClass();
            $info->startDate = $startDate;
            $info->date = date('Y/m/d H:i');
            $info->totalCount = $index->count();
            $info->documentCount = $index->numDocs();
            file_put_contents($pluginindex . '.info', json_encode($info));
        }
    }
}
function indexData($index, $fields, $data)
{