Note that there are some explanatory texts on larger screens.

plurals
  1. POPattern matching of websites
    primarykey
    data
    text
    <p>I maintain a global repository of sites in a table.</p> <pre><code>website: id, name, url 1 google http://www.google.com/ 2 CNN http://www.cnn.com/ 3 SO http://www.stackoverflow.com/ </code></pre> <p>I maintain a reference table, which stores the the website id's the user has stored.</p> <pre><code>userwebsite userid, websiteid [attributes of the table] </code></pre> <p>Say a user is interested to save microsoft; in his collection, he enters</p> <blockquote> <p>www.microsoft.com</p> </blockquote> <p>As the website doesn't exist in the global repository, it first sits in the repository and then gets added to his collection. Now the contents of both the tables looks something like this:</p> <pre><code>website: id, name, url 1 google http://www.google.com/ 2 CNN http://www.cnn.com/ 3 SO http://www.stackoverflow.com/ 4 msft http://www.microsoft.com userwebsite: userid, websiteid 1 4 </code></pre> <p>Say a user is interested in saving google in his collection, and he enters</p> <pre><code>www.google.com </code></pre> <p>As the website is already existing in the collection, instead of adding the website to the collection, only the reference gets added to the user collection.</p> <p>The place where am stuck, </p> <blockquote> <p>both www.google.com and <a href="http://www.google.com/" rel="nofollow">http://www.google.com/</a></p> </blockquote> <p>semantically they point out to the same site, but when you try to match them they are 2 distinct strings. How should I go about matching the strings in such cases?</p> <p>One solution I think of is, input a site first check if the domain exists in the collection of websites (probably a PATINDEX will do good here), by doing this you get a list of sites which have the save domain name. and then check if the path exists in any of the resultant websites. Is this is a good idea?</p> <p>Does a significant solution exist to this problem? Are there any better methods to go about?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload