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 "Nair, Manas" <Ma...@mtvnmix.com> on 2010/03/16 20:59:41 UTC

XML data in solr field

Hello Experts,
 
I need help on this issue of mine. I am unsure if this scenario is possible.
I have a field in my solr document named <inputxml>, the value of which is a xml string as below. This xml structure is within the inputxml field value. I needed help on searching this xml structure i.e. if I search  for Venue, I should get "Radio City Music Hall" as the result and not the complete tag like <Venue value="Radio City Music Hall" />. Is this supported in solr?? If it is, how can this be implemented??
 
<root>
<Venue value="Radio City Music Hall" />
<Link value="http://bit.ly/Rndab" />
<LinkText value="En savoir +" />
<Address value="New-York, USA" />
</root>

Any help is appreciated. I donot need the tag name in the result, instead I need the tag value.
 
Thanks in advance,
Manas Nair

Re: XML data in solr field

Posted by Lance Norskog <go...@gmail.com>.
You can use dynamic fields (wildcard field names) to add any and all
element names. You would have to add a suffix to every element name in
your preparation, but you will not have to add all of the element
names to your schema.

On Wed, Mar 17, 2010 at 7:04 AM, Walter Underwood <wu...@wunderwood.org> wrote:
> Have you considered an XML database? Because this is exactly what they are designed to do.
>
> eXist is open source, or you can use Mark Logic (my employer), which is much faster and more scalable. We do give out free academic and community licenses for Mark Logic.
>
> wunder
>
> On Mar 16, 2010, at 11:04 PM, Nair, Manas wrote:
>
>> Thankyou Tommy. But the real problem here is that the xml is dynamic and the element names will be different in different docs which means that there will be a lot of field names to be added in schema if I were to index those xml nodes separately.
>> Is it possible to have nested indexing (xml within xml) in solr without the overhead of adding all those inner xml nodes as actual fields in solr schema?
>>
>> Manas
>>
>> ________________________________
>>
>> From: Tommy Chheng [mailto:tommy.chheng@gmail.com]
>> Sent: Tue 3/16/2010 5:05 PM
>> To: solr-user@lucene.apache.org
>> Subject: Re: XML data in solr field
>>
>>
>>
>>
>>  Do you have the option of just importing each xml node as a
>> field/value when you add the document?
>>
>> That'll let you do the search easily. If you need to store the raw XML,
>> you can use an extra field.
>>
>> Tommy Chheng
>> Programmer and UC Irvine Graduate Student
>> Twitter @tommychheng
>> http://tommy.chheng.com <http://tommy.chheng.com/>
>>
>>
>> On 3/16/10 12:59 PM, Nair, Manas wrote:
>>> Hello Experts,
>>>
>>> I need help on this issue of mine. I am unsure if this scenario is possible.
>>> I have a field in my solr document named<inputxml>, the value of which is a xml string as below. This xml structure is within the inputxml field value. I needed help on searching this xml structure i.e. if I search  for Venue, I should get "Radio City Music Hall" as the result and not the complete tag like<Venue value="Radio City Music Hall" />. Is this supported in solr?? If it is, how can this be implemented??
>>>
>>> <root>
>>> <Venue value="Radio City Music Hall" />
>>> <Link value="http://bit.ly/Rndab" />
>>> <LinkText value="En savoir +" />
>>> <Address value="New-York, USA" />
>>> </root>
>>>
>>> Any help is appreciated. I donot need the tag name in the result, instead I need the tag value.
>>>
>>> Thanks in advance,
>>> Manas Nair
>>>
>
>
>
>
>
>



-- 
Lance Norskog
goksron@gmail.com

Re: XML data in solr field

Posted by Walter Underwood <wu...@wunderwood.org>.
Have you considered an XML database? Because this is exactly what they are designed to do.

eXist is open source, or you can use Mark Logic (my employer), which is much faster and more scalable. We do give out free academic and community licenses for Mark Logic.

wunder

On Mar 16, 2010, at 11:04 PM, Nair, Manas wrote:

> Thankyou Tommy. But the real problem here is that the xml is dynamic and the element names will be different in different docs which means that there will be a lot of field names to be added in schema if I were to index those xml nodes separately.
> Is it possible to have nested indexing (xml within xml) in solr without the overhead of adding all those inner xml nodes as actual fields in solr schema?
> 
> Manas
> 
> ________________________________
> 
> From: Tommy Chheng [mailto:tommy.chheng@gmail.com]
> Sent: Tue 3/16/2010 5:05 PM
> To: solr-user@lucene.apache.org
> Subject: Re: XML data in solr field
> 
> 
> 
> 
>  Do you have the option of just importing each xml node as a
> field/value when you add the document?
> 
> That'll let you do the search easily. If you need to store the raw XML,
> you can use an extra field.
> 
> Tommy Chheng
> Programmer and UC Irvine Graduate Student
> Twitter @tommychheng
> http://tommy.chheng.com <http://tommy.chheng.com/> 
> 
> 
> On 3/16/10 12:59 PM, Nair, Manas wrote:
>> Hello Experts,
>> 
>> I need help on this issue of mine. I am unsure if this scenario is possible.
>> I have a field in my solr document named<inputxml>, the value of which is a xml string as below. This xml structure is within the inputxml field value. I needed help on searching this xml structure i.e. if I search  for Venue, I should get "Radio City Music Hall" as the result and not the complete tag like<Venue value="Radio City Music Hall" />. Is this supported in solr?? If it is, how can this be implemented??
>> 
>> <root>
>> <Venue value="Radio City Music Hall" />
>> <Link value="http://bit.ly/Rndab" />
>> <LinkText value="En savoir +" />
>> <Address value="New-York, USA" />
>> </root>
>> 
>> Any help is appreciated. I donot need the tag name in the result, instead I need the tag value.
>> 
>> Thanks in advance,
>> Manas Nair
>> 






RE: XML data in solr field

Posted by "Nair, Manas" <Ma...@mtvnmix.com>.
Thankyou Tommy. But the real problem here is that the xml is dynamic and the element names will be different in different docs which means that there will be a lot of field names to be added in schema if I were to index those xml nodes separately.
Is it possible to have nested indexing (xml within xml) in solr without the overhead of adding all those inner xml nodes as actual fields in solr schema?
 
Manas

________________________________

From: Tommy Chheng [mailto:tommy.chheng@gmail.com]
Sent: Tue 3/16/2010 5:05 PM
To: solr-user@lucene.apache.org
Subject: Re: XML data in solr field




  Do you have the option of just importing each xml node as a
field/value when you add the document?

That'll let you do the search easily. If you need to store the raw XML,
you can use an extra field.

Tommy Chheng
Programmer and UC Irvine Graduate Student
Twitter @tommychheng
http://tommy.chheng.com <http://tommy.chheng.com/> 


On 3/16/10 12:59 PM, Nair, Manas wrote:
> Hello Experts,
>
> I need help on this issue of mine. I am unsure if this scenario is possible.
> I have a field in my solr document named<inputxml>, the value of which is a xml string as below. This xml structure is within the inputxml field value. I needed help on searching this xml structure i.e. if I search  for Venue, I should get "Radio City Music Hall" as the result and not the complete tag like<Venue value="Radio City Music Hall" />. Is this supported in solr?? If it is, how can this be implemented??
>
> <root>
> <Venue value="Radio City Music Hall" />
> <Link value="http://bit.ly/Rndab" />
> <LinkText value="En savoir +" />
> <Address value="New-York, USA" />
> </root>
>
> Any help is appreciated. I donot need the tag name in the result, instead I need the tag value.
>
> Thanks in advance,
> Manas Nair
>



Re: XML data in solr field

Posted by Tommy Chheng <to...@gmail.com>.
  Do you have the option of just importing each xml node as a 
field/value when you add the document?

That'll let you do the search easily. If you need to store the raw XML, 
you can use an extra field.

Tommy Chheng
Programmer and UC Irvine Graduate Student
Twitter @tommychheng
http://tommy.chheng.com


On 3/16/10 12:59 PM, Nair, Manas wrote:
> Hello Experts,
>
> I need help on this issue of mine. I am unsure if this scenario is possible.
> I have a field in my solr document named<inputxml>, the value of which is a xml string as below. This xml structure is within the inputxml field value. I needed help on searching this xml structure i.e. if I search  for Venue, I should get "Radio City Music Hall" as the result and not the complete tag like<Venue value="Radio City Music Hall" />. Is this supported in solr?? If it is, how can this be implemented??
>
> <root>
> <Venue value="Radio City Music Hall" />
> <Link value="http://bit.ly/Rndab" />
> <LinkText value="En savoir +" />
> <Address value="New-York, USA" />
> </root>
>
> Any help is appreciated. I donot need the tag name in the result, instead I need the tag value.
>
> Thanks in advance,
> Manas Nair
>