Load document based on url

10 views
Skip to first unread message

marcus

unread,
Dec 9, 2010, 9:08:57 AM12/9/10
to ravendb
How bad idea it is to save the full URL path as metadata or in a field
to retrieve a page based on URL path?
I'm looking for the most effective way to retrieve a page and the only
known thing about the pageis the path example.com/page1/page2/page3

Any recommended solutions?

Rob Ashton

unread,
Dec 9, 2010, 9:11:43 AM12/9/10
to ravendb
If it's unique, you could use it as your primary key =) (Id) (Or hash
it and use it that your primary key, which is probably more sensible,
I forget what the length limits on ID are, and that might differ
between Munin and Esent although again, I forget that too, I wish my
brain wrote to disk on save...)

Using a full text search engine to look up a document on url seems a
bit dirty which is why you asked the question I guess - it will work
though.

marcus

unread,
Dec 9, 2010, 9:46:41 AM12/9/10
to ravendb
I see a problem with saving the full path to the document, if I change
name on page2 to child2, I have to update all the children of the
document.
Just save the slug must be a better option but it feels like I may
have many queries to raven. Calculating the left and right might be
another option or what do you say?

develop...@googlemail.com

unread,
Dec 9, 2010, 1:08:15 PM12/9/10
to rav...@googlegroups.com
Id = hash( url ) sounds good, if You're sure never to change your domain of your site.

marcus

unread,
Dec 9, 2010, 1:33:12 PM12/9/10
to ravendb
If I use this approach I need to figure out a way to update/patch all
child documents and documents that has a link to the document where
the path/url is changed is changed. Any more ideas?



On Dec 9, 7:08 pm, developerher...@googlemail.com wrote:
> Id = hash( url ) sounds good, if You're sure never to change your domain of your site.
>

Ayende Rahien

unread,
Dec 10, 2010, 1:18:21 AM12/10/10
to ravendb
It would be a pretty cheap operation.
Your next messages implies that this can change, so you don't want to make this your id, but a property lookup in very fast in Raven
Reply all
Reply to author
Forward
0 new messages