Here's how I tested creating an index via the api: 

import org.xmldb.api.base.*;
import org.xmldb.api.modules.*;
import org.xmldb.api.*;
import org.apache.xindice.tools.command.*;
import java.util.*;

public class TestIndexer {

        public static void main(String[] args) {
                boolean success = false;
                AddIndexer ai = new AddIndexer();
                Hashtable h = new Hashtable();
                h.put("collection", "servicecodes");
                h.put("nameOf", "sc");
                h.put("pattern", "serviceCode");
                h.put("verbose", "true");
                try {
                success = ai.execute(h);
                }
                catch (Exception e) {
                        System.out.println(e.getMessage()); 
                }
                System.out.println(success);            
        }
}

collection is the name of your collection
nameOf is the name of the index
pattern in the above case is the element indexed on

You can look at the source code in AddIndexer.java for a more complete
understanding

> -----Original Message-----
> From: Paul Brown [SMTP:[EMAIL PROTECTED]
> Sent: Wednesday, March 26, 2003 11:34 AM
> To:   xindice-users@xml.apache.org
> Subject:      FW: Add Indexer using API
> 
> 
> Any ideas anyone?!
> 
> Paul
> -----Original Message-----
> From: Paul Brown [mailto:[EMAIL PROTECTED]
> Sent: 22 March 2003 13:00
> To: xindice-users@xml.apache.org
> Subject: Add Indexer using API
> 
> 
> Does anyone know how to use the Xindice/XML:DB Java API to create
> another index for a collection?
> 
> I have the xml file:
> 
> <keywords>
>       <subject_keywords>
>               <keyword value="zaa"/>
>               <keyword value="aaa"/>
>               <keyword value="aza"/>
>       </subject_keywords>
>       ...
> </keywords>
> 
> I would like to create an index on the 'value' attribute content for
> fast search and retrieval from an xpath query:
> "//keywords[subject_keywords/[EMAIL PROTECTED]'aza']]", and thus an
> indexing on the attribute would speed up the search. I can do this from
> the command line using:
> 
> xindice add_indexer -c /db/keywords/subject_keywords -n keywordindex -p
> [EMAIL PROTECTED]
> 
> Any ideas?
> 
> 
> 
> 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

CONFIDENTIALITY NOTICE: If you have received this e-mail in error, please 
immediately notify the sender by e-mail at the address shown.  This e-mail 
transmission may contain confidential information.  This information is 
intended only for the use of the individual(s) or entity to whom it is intended 
even if addressed incorrectly.  Please delete it from your files if you are not 
the intended recipient.  Thank you for your compliance. Copyright (c) 2003 CIGNA

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Reply via email to