lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cheolgoo Kang" <>
Subject Re: how to index XML elements with the same name using Lucene
Date Mon, 19 Mar 2007 23:36:48 GMT
Keywords.setKeyword(String) could've been able to stack all the
keywords set by the digester. So, setKeyword(String) method should be
written like below using java.util.List:

    public static class KeyWords
        private String lineNum;
        private List<String> kw = new LinkedList<String>();

        public void setLineNum(String newLineNum)
            lineNum = newLineNum;
        public String getLineNum()
            return lineNum;

        public void setKeyWord(String newKW)
            kw.add( newKW );
        public List<String> getKeyWordList()
            return kw;

So, you have to change the IndexKeyWords.addKeywords(Keywords) method
to handle the 'list' of keywords read from xml file. It'll solve the
'reading several elements from xml file' problem.

And make sure you care about those keywords with two or more words.
StandardAnalyzer will split all the words in one keyword if they are
separated by whitespace. Then you'll have to use PhraseQuery or span
queries to search a exact phrase like "controlled hypertension".


On 3/20/07, louiebagz <> wrote:
> hello guys,
> I need some help. I'm working on an XML file and trying to create a lucene
> index for each element. My XML file have repeating elements with different
> values. When I tried to run lucene, it can only index one of the elements.
> Both files are attached for your reference.
> Hoping for your favorable response.
> Thank you!
> Louie
> keywords.xml
> --
> View this message in context:
> Sent from the Lucene - Java Users mailing list archive at


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message