lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Lucene and Digester
Date Thu, 20 Oct 2005 18:14:07 GMT

Hi I have tried as suggested and isolated Digester from Lucene. Digester doesn't trigger an
Element Matching Pattern for each element only the last one of each repeating tag.My XML (trimmed
a bit looks like this):




<title>IEEE Annals of the History of Computing</title>

<issue>Spring 1995 (Vol. 17, No. 1)</issue>

<publisher>Published by the IEEE Computer Society</publisher>


<sec1><title>About this Issue</title></sec1>

<sec1><title>Comments, Queries, and Debate</title></sec1>




Only the last set <sec1><title>Articles</title></sec1> appears when
parsed by Digester as it ignores the first two.

Does anyone know how to stuff many bits of data into one field?

Any help will be really appreciated,



PS my code looks like this.I have tried many other types like keyword for 

the booksDocument.add(Field.Text("title", books.getTitle()));


Digester digester = new Digester();
        digester.addObjectCreate("books", Digester.class );
        digester.addObjectCreate("books/journal", Books.class );
        digester.addCallMethod("books/journal/title",    "setTitle", 0);
        digester.addCallMethod("books/journal/issue",       "setIssue", 0);
        digester.addCallMethod("books/journal/publisher",   "setPublisher", 0);
        digester.addCallMethod("books/journal/sec1/title", "setTitle2", 0);
        digester.addSetNext("books/journal",               "addBooks" );

public void addBooks(Books books) throws IOException
        System.out.println("Adding " + books.getTitle());
        System.out.println("Adding " + books.getIssue());
        System.out.println("Adding " + books.getPublisher());
        System.out.println("Adding " + books.getTitle());
        System.out.println("Adding " + books.getTitle2());
        Document booksDocument  = new Document();
        booksDocument.add(Field.Text("title", books.getTitle()));
        booksDocument.add(Field.Text("issue", books.getIssue()));
        booksDocument.add(Field.Text("publisher", books.getPublisher()));
        booksDocument.add(Field.Text("title", books.getTitle2()));

  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message