Posted by petercasier on October 15, 2009 at 1:41pm
| Project: | OpenSearch feed |
| Version: | 6.x-1.1 |
| Component: | Miscellaneous |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
The RSS feed generated by Opensearch does not validate with Feedvalidator:
E.g. check out this feed query and see the errors with Feedvalidator:
This feed does not validate.
line 11, column 1: Undefined channel element: opensearch:link [help]
<opensearch:link href="http://humanitariannews.org/opensearch/node" type="a ...
^
In addition, interoperability with the widest range of feed readers could be improved by implementing the following recommendations.
line 2, column 0: Use of unknown namespace: http://a9.com/-/opensearch/extensions/relevance/1.0/ [help]
<rss version="2.0" xml:base="http://humanitariannews.org/" xmlns:dc="http:// ...
line 19, column 0: item should contain a guid element (10 occurrences) [help]
</item>
line 87, column 0: Missing atom:link with rel="self" [help]
</channel>Peter
Comments
#1
To fix the validation error, we need to change opensearch:link to atom:link according to the specs: http://www.opensearch.org/Specifications/OpenSearch/1.1/Draft_4
However, when generating an RSS feed for a search performed by the apachesolr_search module, this patch will break the feed, as /opensearch/apachesolr_search (which opesearch:link/atom:link link to) returns malformed/nonsense XML (which should be fixed separately). EDIT I can fix the broken feed if apachesolr 6.x-2.x-dev is used. I haven't tried my local edits in apachesolr 6.x-1.x
#2
Here is a patch to fix the Missing atom:link with rel="self" warning.
#3
I've started a thread in the Feed Validator Google group regarding the Use of unknown namespace warning.
http://groups.google.com/group/feedvalidator-users/browse_thread/thread/...
#4
To add a guid, I implement the recommendation on http://diveintomark.org/archives/2004/05/28/howto-atom-id
Patch attached.
#5
The patch is not in the correct format; the patch should be applied from the directory containing the project files, but even fixing the paths, I get an error message
patch: **** unexpected end of file in patch.#6
The code has been changed, and committed in CVS.
Thanks for the report, and the patch.
#7
My patch naming convention is perhaps confusing.
None of the three patches I submitted (in #1, #2, and #4) are related to each other. Each fixes one validation error/warning.
#1 needs work. It solves the validation error, but exposes a deeper bug in the opensearch module. It should not be applied yet.
#2 is a useful patch that fixes the Missing atom:link with rel="self" warning.
#4 was applied to dev. thanks!
#8
I guess that I should have then applied first #3, and then #4. I am sorry; I thought that the newest would replace the older, as it is usually done.
I will apply also the other patch, or change the code manually, if it doesn't work. Actually, as I am changing the code to fix some problems it has (misuse of
t(), etc), the patch will now not apply anymore; I think I should still be able to change the code following the patch you provided.#9
Just committed changes that made the search results RSS valid (expect for the odd validation errors that were pointed out earlier that we cannot fix).
http://drupal.org/cvs?commit=306468
Results I got from were:
Congratulations!
This is a valid RSS feed.
Recommendations
This feed is valid, but interoperability with the widest range of feed readers could be improved by implementing the following recommendations.
line 2, column 0: Use of unknown namespace: http://a9.com/-/opensearch/extensions/relevance/1.0/ [help]
<rss version="2.0" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" x ...
line 11, column 110: Self reference doesn't match document location [help]
... user/dave" type="application/rss+xml" />
^
line 12, column 125: Unregistered link relationship: search [help]
... pplication/opensearchdescription+xml" />
^
The error on line 11 is because I copied and pasted the XML instead of giving it a location (source is on localhost).
#10
I also removed that complex GUID calculation because it was causing PHP notices when search results do not have a date (like with users, etc). Doing
<guid isPermaLink="false">http://mysql.drupal6dev.local/node/1</guid>is perfectly valid and simple for now.http://drupal.org/cvs?commit=306448
#11
As you are no longer using a tag: URI for the guid, you may remove isPermaLink="false".
To answer the @todo in the commit previous to http://drupal.org/cvs?commit=306448, the regex is transforming the permalink into a tag: URI: http://en.wikipedia.org/wiki/Tag_URI
#12
Automatically closed -- issue fixed for 2 weeks with no activity.