1 17 18 19 20 package org.apache.lenya.lucene.index; 21 22 import java.io.File ; 23 24 import org.apache.lenya.lucene.parser.HTMLParser; 25 import org.apache.lenya.lucene.parser.HTMLParserFactory; 26 import org.apache.lucene.document.Document; 27 import org.apache.lucene.document.Field; 28 29 public class DefaultDocumentCreator extends AbstractDocumentCreator { 30 31 34 public DefaultDocumentCreator() { 35 } 36 37 47 public Document getDocument(File file, File htdocsDumpDir) throws Exception { 48 Document document = super.getDocument(file, htdocsDumpDir); 49 50 HTMLParser parser = HTMLParserFactory.newInstance(file); 51 parser.parse(file); 52 53 document.add(Field.Text("title", parser.getTitle())); 54 document.add(Field.Text("keywords", parser.getKeywords())); 55 document.add(Field.Text("contents", parser.getReader())); 56 57 return document; 58 } 59 } 60 | Popular Tags |