{
    "content": [
        {
            "type": "text",
            "text": "# Plucene::Index::Writer (perldoc)\n\n## NAME\n\nPlucene::Index::Writer - write an index.\n\n## SYNOPSIS\n\nmy $writer = Plucene::Index::Writer->new($path, $analyser, $create);\n$writer->adddocument($doc);\n$writer->addindexes(@dirs);\n$writer->optimize; # called before close\nmy $doccount = $writer->doccount;\nmy $mergefactor = $writer->mergefactor;\n$writer->setmergefactor($value);\n\n## DESCRIPTION\n\nThis is the writer class.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **METHODS**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Plucene::Index::Writer",
        "section": "",
        "mode": "perldoc",
        "summary": "Plucene::Index::Writer - write an index.",
        "synopsis": "my $writer = Plucene::Index::Writer->new($path, $analyser, $create);\n$writer->adddocument($doc);\n$writer->addindexes(@dirs);\n$writer->optimize; # called before close\nmy $doccount = $writer->doccount;\nmy $mergefactor = $writer->mergefactor;\n$writer->setmergefactor($value);",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 13,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 43,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Plucene::Index::Writer - write an index.\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "my $writer = Plucene::Index::Writer->new($path, $analyser, $create);\n\n$writer->adddocument($doc);\n$writer->addindexes(@dirs);\n\n$writer->optimize; # called before close\n\nmy $doccount = $writer->doccount;\n\nmy $mergefactor = $writer->mergefactor;\n\n$writer->setmergefactor($value);\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This is the writer class.\n\nIf an index will not have more documents added for a while and optimal search performance is\ndesired, then the \"optimize\" method should be called before the index is closed.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "new\nmy $writer = Plucene::Index::Writer->new($path, $analyser, $create);\n\nThis will create a new Plucene::Index::Writer object.\n\nThe third argument to the constructor determines whether a new index is created, or whether an\nexisting index is opened for the addition of new documents.\n\nmergefactor / setmergefactor\nmy $mergefactor = $writer->mergefactor;\n\n$writer->setmergefactor($value);\n\nGet / set the mergefactor. It defaults to 5.\n\ndoccount\nmy $doccount = $writer->doccount;\n\nadddocument\n$writer->adddocument($doc);\n\nAdds a document to the index. After the document has been added, a merge takes place if there\nare more than $Plucene::Index::Writer::mergefactor segments in the index. This defaults to 10,\nbut can be set to whatever value is optimal for your application.\n\noptimize\n$writer->optimize;\n\nMerges all segments together into a single segment, optimizing an index for search. This should\nbe the last method called on an indexer, as it invalidates the writer object.\n\naddindexes\n$writer->addindexes(@dirs);\n\nMerges all segments from an array of indexes into this index.\n\nThis may be used to parallelize batch indexing. A large document collection can be broken into\nsub-collections. Each sub-collection can be indexed in parallel, on a different thread, process\nor machine. The complete index can then be created by merging sub-collection indexes with this\nmethod.\n\nAfter this completes, the index is optimized.\n",
                "subsections": []
            }
        }
    }
}