Even with the unique target set (using the example of http://drupal.org/node/845018) I have duplicate content created.

Source 'link' (mapping to URL) is set to unique.

When debugging the code, I found that every item processed contains all the settings of the other items too. For example, the feed contains 10 items, and the URL field of the first item is passed this array of values:

xpathparser:0:
<link>http://shop.flightoftheconchords.co.nz/node/16</link>
<link>http://shop.flightoftheconchords.co.nz/node/15</link>
<link>http://shop.flightoftheconchords.co.nz/node/14</link>
<link>http://shop.flightoftheconchords.co.nz/node/13</link>
<link>http://shop.flightoftheconchords.co.nz/node/12</link>
<link>http://shop.flightoftheconchords.co.nz/node/11</link>
<link>http://shop.flightoftheconchords.co.nz/node/10</link>
<link>http://shop.flightoftheconchords.co.nz/node/9</link>
<link>http://shop.flightoftheconchords.co.nz/node/8</link>
<link>http://shop.flightoftheconchords.co.nz/node/5</link>

Maybe later on the uniqueness test then fails because of this?

Comments

podox’s picture

I have the same issue. Here is my feed:

<rss><channel>
    <title>Channel Title</title>
        <item><title>Item 1</title><guid>A</guid></item>
        <item><title>Item 2</title><guid>B</guid></item>
    </channel></rss>

Context is set to: //channel | //item and mapping settings are:

//item/title -> Node title
//item/guid -> GUID (unique)
//channel/title -> Text Field

I get two nodes created, but both have the title of "Array". I see from the debug code that this is the same issue as the original post.

xpathparser:0:
<title>Item 1</title>
<title>Item 2</title>
xpathparser:1:
<guid>A</guid>
<guid>B</guid>
xpathparser:2:
<title>Channel Title</title>
xpathparser:0:
<title>Item 1</title>
<title>Item 2</title>
xpathparser:1:
<guid>A</guid>
<guid>B</guid>
xpathparser:2:
<title>Channel Title</title>

The channel title is of course mapped correctly because there is only one. The item titles and guids are imported successfully if I set the context to //item and map: title -> node title, but then I lose the ability to also map the channel title.

podox’s picture

Hmm, okay so I've fixed my problem. I use //item as the context which solves the Array problem, and then use ancestor::channel/title to grab the channel title.

So I'm unsure whether the initial error was due to my abuse of XPath or whether this is an underlying bug.

twistor’s picture

Assigned: Unassigned » twistor
Category: bug » support
Status: Active » Fixed

@pvhee,

Things have changed a bit since that guide. Things are simpler now, but not backwards compatible sadly.

<item>
 <title>Ladies - Too Many Dicks Tee</title>
 <link>http://shop.flightoftheconchords.co.nz/node/11</link>
 <description></description>
 <category domain="http://shop.flightoftheconchords.co.nz/taxonomy/term/2">Apparel</category>
 <category domain="http://shop.flightoftheconchords.co.nz/taxonomy/term/3">Ladies Size (US)</category>
 <g:price>45.00000</g:price>
 <g:id>FOC04</g:id>
 <g:image_link>http://shop.flightoftheconchords.co.nz/sites/fotc/files/FOC04-01.jpg</g:image_link>
 <g:image_link>http://shop.flightoftheconchords.co.nz/sites/fotc/files/FOC04-02.jpg</g:image_link>
 <pubDate>Sun, 29 Nov 2009 11:31:03 +0000</pubDate>
 <dc:creator>admin</dc:creator>
 <guid isPermaLink="false">11 at http://shop.flightoftheconchords.co.nz</guid>
</item>
<item>

context: //item
description: description
price: g:price
etc.

The result you are getting is because //link returns all of the links in the document. That indeed will make the save fail since it can only take one result. Hope that helps!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

epawel’s picture

I think I had similar problem. In my case the solution was to delete old records from feeds_source table in Drupal database. I noticed that I used only 10 importers (in feeds_importer table) but had about 20 sources (in feeds_source table). It was the reason that some records were duplicated. Finally I left only one source for one importer and it started working fine.