You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by "Roth, Scott" <sc...@merck.com> on 2003/04/03 17:46:21 UTC

RE: Add Indexer using API

I had a follow-up question on this topic.  I am trying to set up indexes
using xindice-1.1b1.  I used the below sample code as a simple test and
could not get the index to be created via RPC.  I am always getting
success="false" returned to my console.  So then I switched to the embedded
version to try to get better debug information from the System.out.println's
in the Xindice code.  However, the exact same code (with the exception of
"xindice" being changed to "xindice-embed") is working with the embedded
version.  I get this message:

Index node element =
        <?xml version="1.0"?>
<index class="org.apache.xindice.core.indexer.ValueIndexer" name="all"
pattern="
*" />

CREATED : all
True

Is there a known issue with index creation over RPC?  Or am I missing
something obvious?

The next step that I am considering is to start changing println's in the
Xindice code to logging messages to the tomcat log - but I want to avoid
touching Xindice code if possible.


Thanks,

Scott

-----Original Message-----
From: Corcoran, Robert A B247 [mailto:Robert.Corcoran@CIGNA.COM] 
Sent: Wednesday, March 26, 2003 12:02 PM
To: 'xindice-users@xml.apache.org'
Subject: RE: Add Indexer using API


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:pjb00u@cs.nott.ac.uk]
> 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:pjb00u@Cs.Nott.AC.UK]
> 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/keyword[@value='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
> keyword@value
> 
> 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

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


------------------------------------------------------------------------------
Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it.

==============================================================================


RE: Add Indexer using API

Posted by "Vladimir R. Bossicard" <vl...@bossicard.com>.
> The next step that I am considering is to start changing println's in the
> Xindice code to logging messages to the tomcat log - but I want to avoid
> touching Xindice code if possible.

If you are changing println's in the Xindice code (tool package), it's certain
that users will have problems when using the CLI...

But the Xindice code must be refactored so that external applications can use
features (like creating indexes) without using the tool.* classes.

-Vladimir

-- 
Vladimir R. Bossicard
www.bossicard.com