lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mohamed Idrees <>
Subject Indexing multiple equiv fieldnames (revisited)
Date Wed, 22 May 2002 03:33:26 GMT
Can someone clarify me the following:

Will there be any significant change in performance, if one was to
create individual
lucene documents for each of the main element (customer in this case) in
one single xml file?

Wish someone comes out with contribution to avoid this.

----- Original Message -----

If you just paste this message in the file in the
lucene code. Once you've recompiled the Lucene Source, the new jar will
contain the method doc.getArray(name , maxCount).
fieldList is the list of all the fields in the XML document.

Your problem is that all the XML fields are in the same file, so as far
Lucene is concerned,
you're searching the same document, what you need to do is either
the customers over
multiple files or write a little XML parsing method using Xerces or JDom

that will read this customer
XML file and then store each Customer in a separate Lucene Document, at
witch point you won't need
the getArray function because you'll have the logical separation in the
Lucene Index.

PS: please post this conversation on the forum so other people can

-----Original Message-----
From: Mohamed Idrees []
Sent: Tuesday, May 21, 2002 7:44 AM
Subject: Indexing multiple equiv fieldnames (revisited)

hi Nader,


You have come out exactly the same problem I'm facing.  In the following

code of yours what does fieldList refer to (if possible can you mail me
the complete code of using this method):

 /** Returns an Array of String variables representing the Text Values
of a specific <i>name</i>
   * name: the name of the field
   * maxCount : the number of elemets you want to retreive (also helps
   * initialize the size of the array)

 public final String[] getArray(String name , int maxCount) {
  int counter = 0 ;
  String[] tempArray = new String[maxCount] ;
  for (DocumentFieldList list = fieldList; list != null; list = {
   if ( && counter < maxCount &&
list.field.stringValue() != null ) {
    tempArray[counter] = list.field.stringValue() ;
    counter++ ;
  // triming the output to the relevant size
  String[] outputArray = new String[counter] ;
  System.arraycopy(tempArray, 0, outputArray, 0, counter);
  return outputArray;

Moreover, this method seems to retrieve all the values of the same field

from the whole document.  What if suppose I need to retrieve only the
particular value as in the following example:

     <address>Deira, Dubai</address>
     <address>Jalan Yap Kwan Seng</address>

Suppose I want to retrieve "address" where "country=UAE and
name=Idrees", the present lucene Document displays "Karama" for me and
not "Deira,Dubai".

Thanking you in advance.


View raw message