You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Andrew Clegg <an...@gmail.com> on 2009/08/13 15:05:20 UTC

Questions about XPath in data import handler

A couple of questions about the DIH XPath syntax...

The docs say it supports:

   xpath="/a/b/subject[@qualifier='fullTitle']"
   xpath="/a/b/subject/@qualifier"
   xpath="/a/b/c"

Does the second one mean "select the value of the attribute called qualifier
in the /a/b/subject element"?

e.g. For this document:


 
  <subject qualifier="some text" />
 


... I would get the result "some text"?

Also... Can I select a non-leaf node and get *ALL* the text underneath it?
e.g. /a/b in this example?

Thanks!

Andrew.

-- 
View this message in context: http://www.nabble.com/Questions-about-XPath-in-data-import-handler-tp24954223p24954223.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Questions about XPath in data import handler

Posted by Andrew Clegg <an...@gmail.com>.


Noble Paul നോബിള്‍  नोब्ळ्-2 wrote:
> 
> yes. look at the 'flatten' attribute in the field. It should give you
> all the text (not attributes) under a given node.
> 
> 

I missed that one -- many thanks.

Andrew.
-- 
View this message in context: http://www.nabble.com/Questions-about-XPath-in-data-import-handler-tp24954223p24968349.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Questions about XPath in data import handler

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@corp.aol.com>.
yes. look at the 'flatten' attribute in the field. It should give you
all the text (not attributes) under a given node.



On Thu, Aug 13, 2009 at 8:02 PM, Andrew Clegg<an...@gmail.com> wrote:
>
>
>
> Noble Paul നോബിള്‍  नोब्ळ्-2 wrote:
>>
>> On Thu, Aug 13, 2009 at 6:35 PM, Andrew Clegg<an...@gmail.com>
>> wrote:
>>
>>> Does the second one mean "select the value of the attribute called
>>> qualifier
>>> in the /a/b/subject element"?
>>
>> yes you are right. Isn't that the semantics of standard xpath syntax?
>>
>
> Yes, just checking since the DIH XPath engine is a little different.
>
> Do you know what I would get in this case?
>
>> > Also... Can I select a non-leaf node and get *ALL* the text underneath
>> it?
>> > e.g. /a/b in this example?
>
> Cheers,
>
> Andrew.
>
> --
> View this message in context: http://www.nabble.com/Questions-about-XPath-in-data-import-handler-tp24954223p24954869.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>



-- 
-----------------------------------------------------
Noble Paul | Principal Engineer| AOL | http://aol.com

Re: Questions about XPath in data import handler

Posted by Andrew Clegg <an...@gmail.com>.


Noble Paul നോബിള്‍  नोब्ळ्-2 wrote:
> 
> On Thu, Aug 13, 2009 at 6:35 PM, Andrew Clegg<an...@gmail.com>
> wrote:
> 
>> Does the second one mean "select the value of the attribute called
>> qualifier
>> in the /a/b/subject element"?
> 
> yes you are right. Isn't that the semantics of standard xpath syntax?
> 

Yes, just checking since the DIH XPath engine is a little different.

Do you know what I would get in this case?

> > Also... Can I select a non-leaf node and get *ALL* the text underneath
> it?
> > e.g. /a/b in this example?

Cheers,

Andrew.

-- 
View this message in context: http://www.nabble.com/Questions-about-XPath-in-data-import-handler-tp24954223p24954869.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Questions about XPath in data import handler

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@corp.aol.com>.
On Thu, Aug 13, 2009 at 6:35 PM, Andrew Clegg<an...@gmail.com> wrote:
>
> A couple of questions about the DIH XPath syntax...
>
> The docs say it supports:
>
>   xpath="/a/b/subject[@qualifier='fullTitle']"
>   xpath="/a/b/subject/@qualifier"
>   xpath="/a/b/c"
>
> Does the second one mean "select the value of the attribute called qualifier
> in the /a/b/subject element"?
>
> e.g. For this document:
>
>
>
>  <subject qualifier="some text" />
>
>
>
> ... I would get the result "some text"?
yes you are right. Isn't that the semantics of standard xpath syntax?
>
> Also... Can I select a non-leaf node and get *ALL* the text underneath it?
> e.g. /a/b in this example?
>
> Thanks!
>
> Andrew.
>
> --
> View this message in context: http://www.nabble.com/Questions-about-XPath-in-data-import-handler-tp24954223p24954223.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>



-- 
-----------------------------------------------------
Noble Paul | Principal Engineer| AOL | http://aol.com

Re: Questions about XPath in data import handler

Posted by Andrew Clegg <an...@gmail.com>.


Andrew Clegg wrote:
> 
>   <subject qualifier="some text" />
> 

Sorry, Nabble swallowed my XML example. That was supposed to be

[a]
 [b]
  [subject qualifier="some text" /]
 [/b]
[/a]

... but in XML.

Andrew.

-- 
View this message in context: http://www.nabble.com/Questions-about-XPath-in-data-import-handler-tp24954223p24954263.html
Sent from the Solr - User mailing list archive at Nabble.com.