{
    "mode": "perldoc",
    "parameter": "Plucene::TestCase",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Plucene%3A%3ATestCase/json",
    "generated": "2026-06-14T08:01:52Z",
    "synopsis": "use Test::More tests => 10;\nuse Plucene::TestCase;\nnewindex {\nadddocument( foo => \"bar\" );\n};\nreindex {\nadddocument( foo => \"baz\" );\n}\nwithreader {\n$READER->whatever;\n}\nmy $hits = search(\"foo:ba*\");",
    "sections": {
        "NAME": {
            "content": "Plucene::TestCase - Handy functions when testing Plucene\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Test::More tests => 10;\nuse Plucene::TestCase;\n\nnewindex {\nadddocument( foo => \"bar\" );\n};\n\nreindex {\nadddocument( foo => \"baz\" );\n}\n\nwithreader {\n$READER->whatever;\n}\n\nmy $hits = search(\"foo:ba*\");\n",
            "subsections": []
        },
        "EXPORTS": {
            "content": "$DIR\nA directory which is created for the purposes of this test, in which\nthe index will be placed. It will normally be cleaned up at the end\nof the test, unless $Plucene::TestCase::DEBUG is set to allow you to\nperuse the entrails.\n\n$WRITER\nA variable holding the current \"Index::Writer\" object, if there is\none.\n\n$READER\nA variable holding the current \"Index::Reader\" object, if there is\none.\n\n$ANALYZER\nA variable holding the class name of the desired \"Analysis::Analyzer\"\nclass.\n\nnewindex BLOCK (Analyzer)\nCreate a new index, and do the following stuff in the block before\nclosing the index writer. $WRITER is set for the duration of the\nblock.\n\nThe optional parameter should be the class name of the analyzer to\nuse; if not specified, the value from $ANALYZER, which in turn\ndefaults to \"Plucene::Analysis::SimpleAnalyzer\", will be used.\n\nreindex BLOCK (Analyzer)\nSame as \"newindex\", but doesn't create a new index, rather re-uses\nan old one.\n",
            "subsections": [
                {
                    "name": "add_document",
                    "content": "Add a new document to the index, with the given fields and values\n\nwithreader BLOCK\nOpens an index reader in $READER and runs the block.\n\nsearch\nSearches for the query given. If any fields are not specified, they\nwill be assumed to be the default \"text\". Returns a\n\"Plucene::Search::Hits\" object. The value of $ANALYZER will be used\nto construct an analyzer for the query string.\n"
                }
            ]
        },
        "POD ERRORS": {
            "content": "Hey! The above document had some coding errors, which are explained\nbelow:\n\nAround line 49:\n=over without closing =back\n",
            "subsections": []
        }
    },
    "summary": "Plucene::TestCase - Handy functions when testing Plucene",
    "flags": [],
    "examples": [],
    "see_also": []
}