I believe that if there is a "guid" for an item then there is no need to check for duplicate URL. Changing the first two if statements as follows will eliminate one database query for every fetched item.

if (isset($feed_item->options->guid)) {
  ...
}
else if (isset($feed_item->options->original_url)) {
  ...
}
CommentFileSizeAuthor
#6 206217_unique_improvement.patch1.16 KBaron novak

Comments

alex_b’s picture

There are a lot of feeds out there, where GUID changes, but the URL stays the same, that's why we switched to url OR guid duplicate checking with good results.

One thing that might make sense here is: check first for URL, if present, check for GUID, if GUID different, then update node existing node - together with saving revisions of a node this could be an elegant way of tracking changed articles on the web.

However:
- this should be an optional feature
- before we should implement this, we should do a survey on whether my assumptions - that changing GUIDs on the same URL stand for changed content - are correct. i got this impression while working on dupes for over a year now.

mustafau’s picture

Status: Needs review » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

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

shawn dearmond’s picture

Version: 5.x-1.x-dev » 6.x-1.7-beta1
Component: Code » Code feedapi_node
Category: task » bug
Status: Closed (fixed) » Needs review

Sorry, I'd like to open this up for discussion again. I'm using 6.x-1.7-beta1, and this issue has come up for me. For the particular iCal feed that I'm grabbing, 98% of the events, for whatever reason, doesn't have original_url values. Only GUIDs.

However, $feed_item->options->original_url is still "set", it just happens to be blank. So, since '' == '', it's just recognizing most of the feeds as updates.

I would like to propose the following change:

 <?php
if (isset($feed_item->options->original_url) && $feed_item->options->original_url != '') {
...
}
if (isset($feed_item->options->guid) && $feed_item->options->guid != '') {
...
}
?>
aron novak’s picture

This is a really good point that make this process more robust. I'll post a patch here soon.

aron novak’s picture

StatusFileSize
new1.16 KB

Shawn DeArmond: Can you test the patch that it solves the issue as well?
in the function below i use the isset() check also, that's why i went this way.

shawn dearmond’s picture

Status: Needs review » Reviewed & tested by the community

Patch worked for me. Great idea about unsetting the variable.

Thanks!

aron novak’s picture

Status: Reviewed & tested by the community » Fixed

Shawn DeArmon: thanks for cooperating! The fix will be included in today's beta2 version! Stay tuned!

Status: Fixed » Closed (fixed)

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