 |
Previously, we've examined single user field matches, and compound user field matches. Now, we examine how to further fine tune the compound user field matches:
T A G C O D E:
The query we last analyzed was:
<dpHeadline>
<p>
Suggested Links:<br>
<dpQuery issue="archives" userField="film genre" userField="film director" userField="film stars" sort="fuzzy" max="5">
<dpHeadline link="on"><br>
</dpQuery>
which returned the following:
I Love You to Death (Comedy) (Lawrence Kasdan) (Kevin Kline, Tracey Ullman, River Phoenix)
Suggested Links:
Mumford (Comedy) (Lawrence Kasdan) ()
The January Man (Comedy, Suspense) (Pat O'Conner) (Kevin Kline, Harvey Keitel, Susan Sarandon)
Illuminata (Comedy) (John Turturro) (John Turturro)
The Dinner Game (Comedy, Foreign) (Francis Veber) ()
Tapeheads (Comedy) (Bill Fishman) (John Cusack, Tim Robbins)
If you feel that an actor match is more important than a director match, or that a genre match should be the highest, how can you weight the most important field to match on?
By adding weights to the user field values. These values can be any positive or negative decimal number. The following will weight the film stars as the most important match criteria:
<dpHeadline>
<p>
Suggested Links:<br>
<dpQuery issue="archives" userField="film genre" userField="film director" userField="film stars(5)" sort="fuzzy" max="5">
<dpHeadline link="on"><br>
</dpQuery>
Note the addition of (5) after the user field film stars.
Here's the results (with debugging info):
The January Man (Comedy, Suspense) (Pat O'Conner) (Kevin Kline, Harvey Keitel, Susan Sarandon)
Suggested Links:
I Love You to Death (Comedy) (Lawrence Kasdan) (Kevin Kline, Tracey Ullman, River Phoenix)
Blue Collar (Drama) (Paul Schrader) (Richard Pryor, Yaphet Kotto, Harvey Keitel)
Anywhere but Here (Drama, Literary Adaption) (Wayne Wang) (Susan Sarandon, Natalie Portman)
Illuminata (Drama, Literary Adaption) (John Turturro) (John Turturro, Katherine Borowitz, Donal McCann, Beverly D'Angelo, Susan Sarandon, Christopher Walken, Bill Irwin)
Mumford (Comedy) (Lawrence Kasdan) ()
"I Love You to Death" was the best match since it matched a film star and a genre. "Blue Collar" came in second only matching a film star, and the same with "Anywhere but Here" and "Illuminata".
As you can see, weighting the film stars heavily shifted emphasis and may have actually strayed from best matches in our case.
-----
Here are a few more examples:
This weights film stars highest, then film genres, then film directors.
<dpQuery issue="archives" userField="film genre(2)" userField="film stars(3)" userField="film director" sort="fuzzy" max="5">
<dpHeadline link="on"><br>
</dpQuery>
This sets a negative value on directors to say they are bad matches and you'd rather not have them (probably not true in this case).
<dpQuery issue="archives" userField="film genre(2)" userField="film stars(3)" userField="film director(-10)" sort="fuzzy" max="5">
<dpHeadline link="on"><br>
</dpQuery>
-----
Hopefully this series has showcased the potential of userField matches when combined with fuzzy sorts. The suggested links possibilities are endless.
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>
|
 |