 |
You have been cataloging film stories with film genres, film titles, film directors, and film stars (actors) for the past few
months. How can you best use this information?
T A G C O D E:
Film Genre Matching Example:
The following query will search through all of the archives, matching all stories with similar film genres to this story. It will then sort those results using a fuzzy algorithm that weights the matched stories from the best to the worst matches. Once this sort is complete, the query tag will return up to five matches from the top. In summary, you get the best five stories matching on similar film genres.
<dpQuery issue="archives" userField="film genre" sort="fuzzy" max="5">
<dpHeadline link="on"><br>
</dpQuery>
-----------
Here's a modified version with some debugging output, and a higher max so you can see what the results would have been and what film genres each story had:
The following lists the headline and film genres of the story you would be reading. It then lists 5 suggested links matching on film genres. Each links displays the headline and film genres of that story.
<dpHeadline> (<dpUserField name="film genre" number="all">)
<p>
Suggested Links:<br>
<dpQuery issue="archives" userField="film genre" sort="fuzzy" max="5">
<dpHeadline link="on"> (<dpUserField name="film genre" number="all">)<br>
</dpQuery>
The results:
The Body Snatcher (Classic, Horror)
Suggested Links:
Planet of the Vampires (Classic, Horror)
The Changeling (Horror)
The Exorcist (Horror)
Halloween (Horror)
House of Wax (Horror)
As you can see, the story contained the genres: classic and horror. The
query then matched all stories containing "classic" and/or "horror". It then sorted them by the best (the ones with both classic and horror) to the worst (the ones with just classic or horror).
------
Before we move on to more complex queries (those using multiple user fields), let's examine what sort="fuzzier" does. sort="fuzzier" assigns a random value to like weighted matches mixing them up a bit. The concept here is to avoid favoritism, in which the same links get used a too often on suggested links.
If we run the above query again and again right now, it will always return those same five films in that same order. However, if we use sort="fuzzier", the equal weighted "horror" films will get mixed up and may provide different results.
For example:
Suggested Links:<br>
<dpQuery issue="archives" userField="film genre" sort="fuzzier" max="5">
<dpHeadline link="on"> (<dpUserField name="film genre" number="all">)<br>
</dpQuery>
Suggested Links:
Planet of the Vampires (Classic, Horror)
Sleepy Hollow (Horror)
The Changeling (Horror)
The Exorcist (Horror)
Halloween (Horror)
and a second time:
Suggested Links:
Planet of the Vampires (Classic, Horror)
The Texas Chainsaw Massacre (Horror)
Sleepy Hollow (Horror)
Halloween (Horror)
From Beyond (Horror)
So, which should you use? That's up to you. We would recommend sort="fuzzier" if you want to mix up the suggested links just a bit more, hence the name fuzzier.
Next, how to get even better suggested links, by using multiple user fields...
See also:
<dpHeadline>,
<dpUserField>
A D D I T I O N A L < D P Q U E R Y > E X A M P L E S:
S E E A L S O:
Other tag examples that incorporate <dpQuery>
|
 |