You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Peter Hendrickx <ic...@hotmail.com> on 2003/03/21 21:39:04 UTC
Parsing HTMLString stored in a database
Hi, I'm just starting to use Lucene.
Did not find any info about parsing HTML-strings.
Tried something myself, it creates an index without any errors, but also
without any term.
Can someone give me a hint.
public void createIndexFromHTMLString(String sDocument,int DocumentID)
throws Exception{
Document tempDoc = new Document();
HTMLParser parser = new HTMLParser(new StringReader(sDocument));
tempDoc.add(Field.UnIndexed("ID","" +DocumentID));
tempDoc.add( Field.Text("content",parser.getReader()));
IndexWriter writer = new IndexWriter("c:\\lucene-1.2\\testindex", new
StandardAnalyzer(), true);
writer.maxFieldLength = 1000000;
writer.addDocument(tempDoc);
writer.optimize();
writer.close();
}
Peter Hendrickx
_________________________________________________________________
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org