Hi Fayyaz,

again, this is about SAX-Handler not about lucene.

My understanding of what you want:
1. one lucene document for each SPEECH-Element (already implemented)
2. one lucene document for each SCENE-COMMENTARY-Element (not implemented
yet).

correct?

If yes, you can write
                if(qName.equals("SPEECH") ||
qName.equals("SCENE-COMMENTARY")){
                        doc=new Document();
                }
and

public void endElement(String uri, String localName, String qName) throws
SAXException{
...
else if(qName.equals("SCENE-COMMENTARY")){
 Field lines = new Field(qName, elementBuffer.toString(), Field.Store.YES,
Field.Index.TOKENIZED, Field.TermVector.YES);
 doc.add(lines);
}
...
if(qName.equals("SPEECH") || qName.equals("SCENE-COMMENTARY")){
  indexWriter.addDocument(doc);
}

(instead of "indexWriter.addDocument(doc);" in block of
if(qName.equals("LINES")){ )



Best regards
  Karsten

P.S.:
If you want to learn java: 
I really like 
http://www.java-hamster-modell.de/
possible there is an english version somewhere?


syedfa wrote:
> 
> I think I understand what you are saying, but I was hoping you could
> clarify a little further.  in the start-element method, I have the
> following:
> 
>                 if(qName.equals("SPEECH")){ 
>                         doc=new Document(); 
>                 }
> 
> are you saying that I should add an identical block of code for
> <SCENE-COMMENTARY> as well, and include a similar clause in the endElement
> method as well? i.e.
> 
>                          else if(qName.equals("SCENE-COMMENTARY")){ 
>                                 Field lines = new Field(qName,
> elementBuffer.toString(), Field.Store.YES, Field.Index.TOKENIZED,
> Field.TermVector.YES); 
>                                 lines.setBoost(1.0f); 
>                                 doc.add(lines); 
>                                 indexWriter.addDocument(doc);
>                          } 
> 
> Does it also matter where in the if/else if clauses I mention the
> "SCENE-COMMENTARY" tag?  ie. should I mention it first?  last?  or does
> the order matter?
> 
> Just wondering.
> Thanks again for your prompt reply.
> Sincerely;
> Fayyaz
> 
> P.S.  This is actually a personal project, as I have developed an interest
> in Information Retrieval and simply wanted to work on a creative project
> to help me develop my skills.  :-) 
> 

-- 
View this message in context: 
http://www.nabble.com/Creating-an-index-from-an-XML-file-using-Lucene-in-Java-tp18678779p18686430.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to