Taxonomy & Term IDs wrong after Import

Topics: Customizing Orchard, Troubleshooting
Nov 5, 2012 at 4:22 PM

I'm migrating data from one Orchard instance to another. I've exported everything. When I import my Taxonomies (and later my ContentTypes and Queries which have taxonomy parts/filters attached), the IDs for the corresponding Taxonomies and Terms are mismatched or don't exist at all in the new instance. 

For example:

Original Site:
CustomContentType > Taxonomy Term ID = 383. 

Taxonomies_TermPartRecord_ids:

  • 16
  • 17
  • 18
  • 19
  • 20
  • 22
  • 23
  • 24
  • 25
  • 26
  • 153
  • 154
  • 155
  • 156
  • 157
  • 220
  • 233
  • 260
  • 277
  • 309
  • 383
  • 422
  • 494
  • 495
  • 531 


New Site:
Taxonomy Term ID 383 does not exist.

Taxonomies_TermPartRecord_ids:

  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42

It's as if the new site's taxonomy tables don't have their data inserted with the IDs from the export/old site, but instead reseed. This is causing several issues. Some queries don't work at all because the ID it's looking for doesn't exist. Other queries are mismatched because the Taxonomy Category the query is filtering on matches to another category altogether. No errors are thrown on the Import, and no errors are logged. Everything appears to work, but at runtime - #fail.

Ideas?

Coordinator
Nov 6, 2012 at 1:27 AM

The ids shouldn't matter. What do you see in the export file? Do you have queries that depend on ids?

Nov 6, 2012 at 1:37 AM
Edited Nov 6, 2012 at 1:39 AM

Hey Bertrand. See this thread that @TheMonarch and I have been on. It goes into much more detail:  http://orchardtaxonomies.codeplex.com/discussions/401997

The issue is the Taxonomy Filter for my queries. It's stored as XML in the Orchard_Projections_FilterRecord table as <TermIds>383</TermIds>. When "Queries" are exported, the XML for the Filter looks like (&lt;TermIds&gt;383&lt;/TermIds&gt;). When these are imported into the new Orchard install, that ID doesn't necessarily map to anything anymore.

If there's a way for the Taxonomy Query Filter XML to store a reference value instead of the DB id, it may remap correctly on import, but as-is (Orchard 1.5.1 / Taxonomies 1.4) it doesn't let that happen. Any additional ideas? Otherwise, I'll go with the suggested solution on that other thread.

Nov 6, 2012 at 1:44 AM
Edited Nov 6, 2012 at 1:44 AM

...Don't tell me it's as easy as giving my Taxonomy Query Filter a text description as opposed to leaving it blank and letting Orchard set the value. =)

Coordinator
Nov 6, 2012 at 1:47 AM

Ah, that's a bug then. Identities in export files should be consistent, and the export logic for taxonomies should use those standard identities rather than non-guaranteed internal DB ids. Please file a bug.

Nov 6, 2012 at 1:52 AM
Edited Nov 6, 2012 at 2:45 AM

Sure.

In the meantime, I was able to go back into my queries and give my taxonomy content filters a text description which then stored the description in the FilterRecord table. I can hopefully use this to find/replace content in my export XML with the correct TermIds

Thanks

Nov 6, 2012 at 4:18 AM

Bug logged: http://orchard.codeplex.com/workitem/19224