Issue Details (XML | Word | Printable)

Key: SEARCH-232
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Normal Normal
Assignee: Paul Taylor
Reporter: Ian McEwen
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
MusicBrainz Search Server

Search server should return information about when the indexes were last updated

Created: 01/Sep/12 01:25 PM   Updated: 03/Oct/12 05:59 AM   Resolved: 14/Sep/12 09:43 AM
Component/s: None
Affects Version/s: None
Fix Version/s: 2012-09-18

Issue Links:
Depends
 
Relates
 


 Description  « Hide

Since we'd like to show the last-updated dates for indexes on the main site (MBS-2449) it'd be nice if the search server passed back this information somehow; it could be as simple as adding a Last-Modified header to the HTTP response, if it's inadvisable to add it to the XML directly.



Sort Order: Ascending order - Click to sort in descending order
Paul Taylor added a comment - 10/Sep/12 08:31 AM

I prefer the idea of outputting in the XML because this is where everything else is output so it wuld be a pain for an application to look in a different location for this information especially if they have to pass the results to another function because we then have two pieces of information to pass around, the metadata itself and the indexlastmodified date. We already output the search scores in the Xml, although score is not part of the MMD extensions can be added and score is such an extension, so my plan was to add indexLastModified field attribute to the <metadata> element in the same way although <metadata> already has defined a 'created' attribute defined which never appears to be used I wonder what is intended use and whether I should use this.


Paul Taylor added a comment - 10/Sep/12 08:06 PM

Paul Taylor added a comment - 12/Sep/12 03:17 PM

Added datetime to created attribute using the http://www.w3.org/TR/xmlschema-2/#dateTime format
Currently using default timezone of GMT and accuracy down to miliseconds (may drop that)
i.e.
<metadata created="2012-09-12T15:09:32.898Z"

Also http://en.wikipedia.org/wiki/List_of_HTTP_header_fields list last-modified example value as

Tue, 15 Nov 1994 12:45:26 GMT

Is this what what you want as the format, looks like it will be difficult for client to parse if required.


Ian McEwen added a comment - 12/Sep/12 05:49 PM

For the Last-Modified header, we should use whatever's the standard; what I can find suggests that what you listed from wikipedia is correct.

For the XML, what you've done seems fine; the milliseconds probably aren't useful, as you say, but I don't know that there's reason to exclude them either.


Paul Taylor added a comment - 13/Sep/12 08:50 AM

Added last-modified to header for all databases based indexes for ws/2 queries.
Now available on test.musicbrainz.org, I would suggest when you fix MBS-2449 you make sure you check if header exists before trying to display it because I can get this fix into next release of SearchServer that contains the json output and is frontend changes only, but this means you wont get a lastmodified date for the freedb index. Adding a lastmodified date for freedb in both <metadata> and header requires a change to the indexing code and hence will require a full search server release that will come later. Also as long as you make the check you can add the code for your issue now and it will just start working when search server is released.


Paul Taylor added a comment - 14/Sep/12 09:43 AM

Ah misread the code, actually freedb indexes do already contain the lastipdated value so this issue is fully fixed.


Ian McEwen added a comment - 20/Sep/12 03:14 AM

I'm not seeing any last-updated data in the freedb return values – e.g. http://search.musicbrainz.org/ws/2/freedb/?query=blah&fmt=json

MBS-2449 patch checks for the existence/nonexistence of the last_updated value anyway, since we use the same templates for direct search – but you may want to look into it


Paul Taylor added a comment - 20/Sep/12 07:24 AM

Ah I don't think freedb indexes get built very often, and perhaps they havent been built since the date updated was added to the index, I'll have to check with Rob.