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 Dan Barron <db...@mail.acponline.org> on 2002/09/13 16:59:53 UTC

XPath in Indexer Patterns

I asked this question back in July and despite some good natured responses trying to help (which I do appreciate) I never got a definitive answer. I'd love to hear from someone who has done this successfully (if it is indeed possible) or one of the developers saying definitively that it is or is not possible. The documentation is ambiguous.

The basic question is, does the -p argument to the Add Indexer command have to be only a single element or attribute name, or can I speficify an XPath there.

Here's a specific example: I'm loading XML data for scientific journal citations. The XML contains author information including a LastName and FirstName elements. Those is what I want to index, so I can find articles written by a certain author quickly.

Problem is, the XML also contains these element names in other places NOT the author of the article. I have no control over the DTD or XML I'm getting; it is generated by a government agency. 

So the question is, can I define -p as something like "\Citation\AuthorList\Author\LastName" or can I only index on "LastName" alone (in which case I guess my code would have to determine if the search term is in the "right" LastName element.

I said above the documentation is ambiguous. By that I meant that all the examples use only a single element or attribute name, but it doesn't say what I want to do *can't* be done.

Any help would be appreciated.

dan



____________________________________________________________________
Daniel W. Barron
Senior Systems Analyst/Application Developer
American College of Physicians-American Society of Internal Medicine
Tel: (215) 351-2617     Tel: (800) 523-1546 x2617
Fax: (215) 351-2644    E-mail: dbarron@mail.acponline.org



Re: XPath in Indexer Patterns

Posted by Fernando Padilla <fe...@interdimensions.com>.
I don't know the answer, but I believe you have less to worry about than 
you think.  The creation of the Indexer over LastName is just an 
optimization for the XPath engine, it does not change your client code at 
all.  Your XPaths would still ask for what they are asking for currently, 
but only if an index exists that would make the execution of that XPath go 
faster, is the index used...

feel better?

Fernando


On Fri, 13 Sep 2002, Dan Barron wrote:

> I asked this question back in July and despite some good natured responses trying to help (which I do appreciate) I never got a definitive answer. I'd love to hear from someone who has done this successfully (if it is indeed possible) or one of the developers saying definitively that it is or is not possible. The documentation is ambiguous.
> 
> The basic question is, does the -p argument to the Add Indexer command have to be only a single element or attribute name, or can I speficify an XPath there.
> 
> Here's a specific example: I'm loading XML data for scientific journal citations. The XML contains author information including a LastName and FirstName elements. Those is what I want to index, so I can find articles written by a certain author quickly.
> 
> Problem is, the XML also contains these element names in other places NOT the author of the article. I have no control over the DTD or XML I'm getting; it is generated by a government agency. 
> 
> So the question is, can I define -p as something like "\Citation\AuthorList\Author\LastName" or can I only index on "LastName" alone (in which case I guess my code would have to determine if the search term is in the "right" LastName element.
> 
> I said above the documentation is ambiguous. By that I meant that all the examples use only a single element or attribute name, but it doesn't say what I want to do *can't* be done.
> 
> Any help would be appreciated.
> 
> dan
> 
> 
> 
> ____________________________________________________________________
> Daniel W. Barron
> Senior Systems Analyst/Application Developer
> American College of Physicians-American Society of Internal Medicine
> Tel: (215) 351-2617     Tel: (800) 523-1546 x2617
> Fax: (215) 351-2644    E-mail: dbarron@mail.acponline.org
> 
> 
>