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 Adi_Jinx <ro...@yahoo.com> on 2009/02/16 19:17:14 UTC

Input XML duplicate fields uniqueness

Hi,

I have an Input XML as

<rec id="1" updt="12-Feb-2009">
<updated_rec>
<account id="1" loc="NJ" pass="safsafsd#sf08" type="Dev" active="1">
	<updated_item>
		<loc new="NJ" old="CP">	
	</updated_item>
</account>
<account id="2" loc="KL" pass="080jnkdfhjwf" type="Int" active="0" >
	<updated_item>
		<pass new="080jnkdfhjwf" old="08dedddddf">	
	</updated_item>
</account>
</updated_rec>
</rec>

now for SOLR indexing converted it to
<add><doc>
<field name="rec.id">1</field>
<field name="rec.updt">12-Feb-2009</field>

<field name="rec.updated_rec.account.id">1</field>
<field name="rec.updated_rec.account.loc">NJ</field>
<field name="rec.updated_rec.account.pass">safsafsd#sf08</field>
<field name="rec.updated_rec.account.type">Dev</field>
<field name="rec.updated_rec.account.active">1</field>
<field name="rec.updated_rec.account.updated_item.loc.new">NJ</field>
<field name="rec.updated_rec.account.updated_item.loc.old">CP</field>

<field name="rec.updated_rec.account.id">2</field>
<field name="rec.updated_rec.account.loc">KL</field>
<field name="rec.updated_rec.account.pass">080jnkdfhjwf</field>
<field name="rec.updated_rec.account.type">Int</field>
<field name="rec.updated_rec.account.active">0</field>
<field
name="rec.updated_rec.account.updated_item.pass.new">080jnkdfhjwf</field>
<field
name="rec.updated_rec.account.updated_item.pass.old">08dedddddf</field>
</doc></add>


I was able to index it. Just put this single xml and searched based on
rec.id and response xml returned however input xml tag order was not
maintained. So I was unable to identify which attributes of account belongs
to which account. Is there any way out to maintain order? or tokenize the
field name so that primary key can be appended
(rec.updated_rec.account.1.loc) however still be able to search
rec.updated_rec.account.loc field...

Need some suggestion.. may be my apporach is totally wrong in dealing with
this problem.


-- 
View this message in context: http://www.nabble.com/Input-XML-duplicate-fields-uniqueness-tp22042765p22042765.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Input XML duplicate fields uniqueness

Posted by Adi_Jinx <ro...@yahoo.com>.



Shalin Shekhar Mangar wrote:
> 
> How about creating a Solr document for each account and adding the recid
> and
> updt attributes from the record tag?
> 
> -- 
> Regards,
> Shalin Shekhar Mangar.
> 
> 

Done... In fact I used this idea and its working fine.. Thanks a ton
-- 
View this message in context: http://www.nabble.com/Input-XML-duplicate-fields-uniqueness-tp22042765p22080507.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Input XML duplicate fields uniqueness

Posted by Adi_Jinx <ro...@yahoo.com>.


Shalin Shekhar Mangar wrote:
> 
> On Mon, Feb 16, 2009 at 11:47 PM, Adi_Jinx <ro...@yahoo.com> wrote:
> 
> How about creating a Solr document for each account and adding the recid
> and
> updt attributes from the record tag?
> 
> -- 
> Regards,
> Shalin Shekhar Mangar.
> 
> 

However then I do need to allow duplicate for my uniqueue key that is
rec.id. My purpose is to track account changes and somebody should be able
to query it. XML posted here only has entity_updated, I have added and
deleted also. IN that case I may have to post 4-5 docs with same rec.id. Is
there ay other way out?>
-- 
View this message in context: http://www.nabble.com/Input-XML-duplicate-fields-uniqueness-tp22042765p22049210.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Input XML duplicate fields uniqueness

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Mon, Feb 16, 2009 at 11:47 PM, Adi_Jinx <ro...@yahoo.com> wrote:

>
> I was able to index it. Just put this single xml and searched based on
> rec.id and response xml returned however input xml tag order was not
> maintained. So I was unable to identify which attributes of account belongs
> to which account. Is there any way out to maintain order? or tokenize the
> field name so that primary key can be appended
> (rec.updated_rec.account.1.loc) however still be able to search
> rec.updated_rec.account.loc field...
>

How about creating a Solr document for each account and adding the recid and
updt attributes from the record tag?

-- 
Regards,
Shalin Shekhar Mangar.