Index: lucene/contrib/demo/src/test/org/apache/lucene/demo/test-files/html/test2.html =================================================================== --- lucene/contrib/demo/src/test/org/apache/lucene/demo/test-files/html/test2.html (revision 0) +++ lucene/contrib/demo/src/test/org/apache/lucene/demo/test-files/html/test2.html (revision 0) @@ -0,0 +1,9 @@ + +
+ + + + + This document is actually not about cats! + + Property changes on: lucene\contrib\demo\src\test\org\apache\lucene\demo\test-files\html\test2.html ___________________________________________________________________ Added: svn:eol-style + native Index: lucene/contrib/demo/src/test/org/apache/lucene/demo/test-files/queries2.txt =================================================================== --- lucene/contrib/demo/src/test/org/apache/lucene/demo/test-files/queries2.txt (revision 0) +++ lucene/contrib/demo/src/test/org/apache/lucene/demo/test-files/queries2.txt (revision 0) @@ -0,0 +1 @@ ++contents:dogs +contents:fish Property changes on: lucene\contrib\demo\src\test\org\apache\lucene\demo\test-files\queries2.txt ___________________________________________________________________ Added: svn:eol-style + native Index: lucene/contrib/demo/src/test/org/apache/lucene/demo/TestDemo.java =================================================================== --- lucene/contrib/demo/src/test/org/apache/lucene/demo/TestDemo.java (revision 1031463) +++ lucene/contrib/demo/src/test/org/apache/lucene/demo/TestDemo.java (working copy) @@ -43,4 +43,24 @@ System.setOut(outSave); } } + + // LUCENE-591 + public void testIndexKeywords() throws Exception { + File dir = getDataFile("test-files/html"); + File indexDir = new File(TEMP_DIR, "demoIndex2"); + IndexHTML.main(new String[] { "-create", "-index", indexDir.getPath(), dir.getPath() }); + File queries = getDataFile("test-files/queries2.txt"); + PrintStream outSave = System.out; + try { + ByteArrayOutputStream bytes = new ByteArrayOutputStream(); + PrintStream fakeSystemOut = new PrintStream(bytes); + System.setOut(fakeSystemOut); + SearchFiles.main(new String[] { "-index", indexDir.getPath(), "-queries", queries.getPath()}); + fakeSystemOut.flush(); + String output = bytes.toString(); // intentionally use default encoding + assertTrue(output.contains("1 total matching documents")); + } finally { + System.setOut(outSave); + } + } } Index: lucene/contrib/demo/src/java/org/apache/lucene/demo/HTMLDocument.java =================================================================== --- lucene/contrib/demo/src/java/org/apache/lucene/demo/HTMLDocument.java (revision 1031463) +++ lucene/contrib/demo/src/java/org/apache/lucene/demo/HTMLDocument.java (working copy) @@ -70,6 +70,11 @@ // Add the tag-stripped contents as a Reader-valued Text field so it will // get tokenized and indexed. doc.add(new Field("contents", parser.getReader())); + + // add any document keywords if they exist + String keywords = parser.getMetaTags().getProperty("keywords"); + if (keywords != null) + doc.add(new Field("contents", keywords, Field.Store.NO, Field.Index.ANALYZED)); // Add the summary as a field that is stored and returned with // hit documents for display. Index: lucene/contrib/CHANGES.txt =================================================================== --- lucene/contrib/CHANGES.txt (revision 1031467) +++ lucene/contrib/CHANGES.txt (working copy) @@ -143,6 +143,9 @@ * LUCENE-590: Demo HTML parser gives incorrect summaries when title is repeated as a heading (Curtis d'Entremont via Robert Muir) + +* LUCENE-591: The demo indexer now indexes meta keywords. + (Curtis d'Entremont via Robert Muir) API Changes