Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 30146 invoked from network); 19 Mar 2007 23:37:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 19 Mar 2007 23:37:17 -0000 Received: (qmail 31152 invoked by uid 500); 19 Mar 2007 23:37:19 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 30824 invoked by uid 500); 19 Mar 2007 23:37:18 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 30813 invoked by uid 99); 19 Mar 2007 23:37:18 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Mar 2007 16:37:17 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of appler@gmail.com designates 209.85.132.244 as permitted sender) Received: from [209.85.132.244] (HELO an-out-0708.google.com) (209.85.132.244) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Mar 2007 16:37:09 -0700 Received: by an-out-0708.google.com with SMTP id c3so1247385ana for ; Mon, 19 Mar 2007 16:36:48 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=C63hF99BkInxwibz90jP6WKc1QA1/9ujnz79/X+qsmpiECg9jsVUdkER8BqBArm5KOGyvbsjtt8ZO4Jve6z+fn8DX7BKzr4vs5C8I97HhyppJIicmruWNHlaSsqEd7SasUCywH0n5fzmWwzIUUQkVwwVxf8JzJhmA5yS2qa1wqg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=CB0fHdO0kQS/G8aGRM/+cNAQ2oKKjKW7rgaZBtl+q7QEJdYkkfUZCNPIx9MHKQjj8punb0Tg/rF2tofY8JeDnnCZAZwKj+RYA9Ho85H/O+pHXMQg316LfyKmlbs/mUOOOJLXzbrD8kxxjh3ykx4IackmxrP5PXAlvBXOP3ZtTj8= Received: by 10.100.119.14 with SMTP id r14mr4309457anc.1174347408660; Mon, 19 Mar 2007 16:36:48 -0700 (PDT) Received: by 10.100.8.6 with HTTP; Mon, 19 Mar 2007 16:36:48 -0700 (PDT) Message-ID: <48b708490703191636r11a0fd8xf66b930faf846d0a@mail.gmail.com> Date: Tue, 20 Mar 2007 08:36:48 +0900 From: "Cheolgoo Kang" To: java-user@lucene.apache.org Subject: Re: how to index XML elements with the same name using Lucene In-Reply-To: <9555198.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <9555198.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org 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 kw = new LinkedList(); public void setLineNum(String newLineNum) { lineNum = newLineNum; } public String getLineNum() { return lineNum; } public void setKeyWord(String newKW) { kw.add( newKW ); } public List 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". HTH 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 > > http://www.nabble.com/file/7271/keywords.xml keywords.xml > http://www.nabble.com/file/7272/IndexKeyWords.java IndexKeyWords.java > > -- > View this message in context: http://www.nabble.com/how-to-index-XML-elements-with-the-same-name-using-Lucene-tf3428085.html#a9555198 > Sent from the Lucene - Java Users mailing list archive at Nabble.com. > -- Cheolgoo --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org