<dpQuery>
D E F I N I T I O N:
<dpQuery
issue="this|all|archives|issue|issueID|
-this|-all|-archives|-issue|-issueID"
section="this|all|section|sectionID|
-this|-all|-section|-sectionID"
column="this|all|column|columnID|
-this|-all|-column|-columnID"
author="this|all|author|authorID|
-this|-all|-author|-authorID"
columnType="all|column|interstitial|
-all|-column|-interstitial"
userField="name|match|value"
volumeNumber="#|-#"
issueNumber="#|-#"
includethis="yes|no"
paginated="yes|no|all"
max="#"
min="#"
sort="issue|section|column|author|story|
-issue|-section|-column|-author|-story"
exclude="<dpQuery>"
realm="author|column|section|issue"
return="value|count"
>
Simple Query Format:
<dpQuery>
{Looping Query Section}
</dpQuery>
The query tag is a container tag, meaning it requires an opening and closing tag: <dpQuery></dpQuery>. To define and execute a query, the above syntax is all that is needed. However, you will usually use at least one attribute to refine your query for your specific needs.
Everything that appears within the {Looping Query Section} will be repeated for each match.
For example, the following syntax queries all of the publication's archives looking for matches of the cinema column. If it finds a match, it will output a linked headline of the matching story.
|
<dpQuery column="cin"> <dpHeadline link="on"> </dpQuery> |
Native Talent Last Night Stand Seeing Through The Roos X Marks The Plot etc. |
Complete Query Format:
The query tag also includes additional tags that can be optionally used within the query container to extend the functionality of the query tag.
<dpQuery>
{Header Section}
<dpLoop>
{Looping Query Section}
</dpLoop>
{Footer Section}
<dpFail>
{Failed Query Section}
</dpQuery>
The advantage to using the <dpLoop></dpLoop> container tag is so that you can define a {Header Section} and/or a {Footer Section}
The header and footer sections will only be displayed once for the entire query, where the information within the <dpLoop></dpLoop> container tag will be displayed for each match. Please see the examples below.
A T T R I B U T E S:
issue="this" - This is the default value and only queries the issue being built.
issue="all" - Queries all issues, including the issue being built.
issue="archives" - Queries all issues before the issue being built. The issue being built is not included, only the issues that precede it in date. Most commonly used for suggested links.
issue="issue|issueID" - You can specify a specific issue using <dpIssue>/<dpIssueID> format: yyyy-mm-dd. Example: issue="1999-10-22"
section="this" - limits the query to the current section being built. For example, if the page being built is in the film section, it would only query film.
section="all" - queries all sections. This is the default value.
section="section|sectionID" - queries a specific section you designate. Both <dpSection> & <dpSectionID> syntax can be used. Example: section="music"
column="this" - limits the query to the current column being built. For example, if the story being built is a cinema feature column, it would only query other stories that are cinema feature columns.
column="all" - queries all columns. This is the default value.
column="column|columnID" - queries a specific column you designate. Both <dpColumn> & <dpColumnID> syntax can be used. Example: column="cover"
author="this" - limits the query to the current author of the story being built. For example, if the story being built is written by Jeff Smith, it would only query other stories that were written by Jeff Smith.
author="all" - queries all authors. This is the default value.
author="author|authorID" - queries a specific author you designate. Both <dpAuthor> & <dpAuthorID> syntax can be used.
paginated="yes" - limits the query to paginated pages only. This is the default.
paginated="no" - limits the query to non-paginated pages only.
paginated="all" - queries both paginated and non-paginated pages.
includethis="yes" - tells the query to include itself, the story currently being built, within the query.
includethis="no" - tells the query not to include itself, the story currently being built, within the query. This is the default.
+ = ascending
- = descending
For example:
The following code first creates a list of up to 3 (max="3") stories by "this" author from the archives. It then performs a test to see if there were greater than 3 (gt 3) stories by this author in the archives. If there were, it puts in a link to their author archive page. If there weren't, nothing is displayed. The goal here was to prevent the "more..." link from being displayed unless there truly were more. <dpQuery return="count"> makes it easy to achieve this, and avoids incrementing variables.
<dpQuery issue="archives" author="this" max="3">
More by <dpAuthor>:<br>
<dpLoop>
<dpHeadline link="on"><br>
</dpLoop>
</dpQuery>
<dpIf <dpQuery issue="archives" author="this" return="count"> gt 3>
<a href="../archives/authors/<dpAuthorID>.html">more...</a><br>
</dpIf>
Another example for comparison:
Note: return="value" is the default, and therefore not needed.
<dpQuery issue="archives" column="music">
<dpHeadline><br>
</dpQuery>
would return this:
The Sound and the Fury
Scavengers of the Vast Wasteland
Make Your Mama Proud
High Impact
---
<dpQuery issue="archives" column="music" return="count">
would return "4".
E X A M P L E S:
|
<dpQuery column="cin"> <b>Recently in this column:</b><br> <dpHeadline link="on"><br> </dpQuery> |
Recently in this column: Native Talent Recently in this column: Last Night Stand Recently in this column: Seeing Through The Roos Recently in this column: X Marks The Plot etc. |
|
<dpQuery column="cin"> <b>Recently in this column:</b><br> <dpLoop> <dpHeadline link="on"><br> </dpLoop> </dpQuery> |
Recently in this column: Native Talent Last Night Stand Seeing Through The Roos X Marks The Plot etc. |
|
<b>Recently in this column:</b><br> <dpQuery column="danehy"> <dpHeadline link="on"><br> </dpQuery> |
Recently in this column: |
|
<b>Recently in this column:</b><br> <dpQuery column="danehy"> <dpHeadline link="on"><br> <dpFail> No matches found<br> </dpQuery> |
Recently in this column: No matches found |
Also in this Section [1/2]
The following query would be a common query to include on a sectional table of contents, like for your music or film section.
T A G C O D E:
<dpQuery issue="this" section="music">
<dpHeadline link="on"><br>
<dpSummary>
<p>
</dpQuery>
E F F E C T:
The Burden of Spoof
Prince of parody Weird Al Yankovic polkas into the TCC on March 1.
Soundbites
Making mountains out of Molehill... The BMI Showcase lowdown... Soundbites salutes Al Perry... and more!
Rhythm & Views
Wise words on the latest from The Rusty Boys.
Club Listings
What's happening at Tucson night spots this week.
Also in this Section [2/2]
The following query picks up where the previous left off, but makes it more dynamic and multi-purpose for all table of contents pages by using "this" rather then hard coding "music". It also tests for an author and displays the author name(s) if the story is credited.
T A G C O D E:
<dpQuery issue="this" section="this">
<dpHeadline link="on"><br>
<dpSummary><br>
<dpIf <dpAuthor>>
<dpAuthorCredit> <dpAuthor>
</dpIf>
<p>
</dpQuery>
E F F E C T:
The Burden of Spoof
Prince of parody Weird Al Yankovic polkas into the TCC on March 1.
By Curtis McCrary
Soundbites
Making mountains out of Molehill... The BMI Showcase lowdown... Soundbites salutes Al Perry... and more!
By Stephen Seigel
Rhythm & Views
Wise words on the latest from The Rusty Boys.
Fred Mills
Club Listings
What's happening at Tucson night spots this week.
Using the Negate Operator
There are often scenarios where you want to query over a section, but exclude a column or a few columns. This can be achieved simply by using the negate operator. For example, say we want to list all the stories in the film section, but not the film times, or tv times. Here's how that works:
T A G C O D E:
<dpQuery issue="this" section="film" column="-filmtimes" column="-tvtimes">
<dpHeadline link="on"><br>
<dpSummary>
<p>
</dpQuery>
E F F E C T:
Billionaire Boys Flub
Skip "Boiler Room" and rent "Glengarry Glen Ross" or "Wall Street" instead.
Film Clips
Check out Tucson Weekly's capsule reviews.
More by this Author [1/4]
The following query searches through all of the archives looking for additional stories by this author. If matches are found it will display the output and return a maximum of 3 links. Note: if no matches are found, the "More by this author:" will still be displayed.
T A G C O D E:
<b>More by this author:</b><br>
<dpQuery issue="archives" author="this" max="3">
<dpHeadline link="on"><br>
</dpQuery>
E F F E C T:
More by this author:
Savage Love
Germ Warfare
Cross Your Heart
More by this Author [2/4]
The following query searches through all of the archives looking for additional stories by this author. If matches are found it will display the output and return a maximum of 3 links. If no matches are found, nothing will be displayed.
In addition to preventing anything from being displayed if no matches are found, this version has replaced the word "author" with the author's name, and added a summary and issue date.
T A G C O D E:
<dpQuery issue="archives" author="this" max="3">
<b>More by <dpAuthor>:</b><p>
<dpLoop>
<dpHeadline link="on"><br>
<dpSummary>
<font size="2">[<dpIssueDate begin="%m-%d-%Y">]</font>
<p>
</dpLoop>
</dpQuery>
E F F E C T:
More by Dan Savage:
Savage Love
Las Vegas is a sexy city, and I am a sheltered Seattleite. I want to explode! Should I become a showgirl?
[01-20-2000]
Savage Love
Making any special plans for New Year's Eve? Prepared for Y2K? Laying in any provisions?
[12-30-1999]
Cross Your Heart
I recently met an ambitious, attractive, charming, talented, and terrific young woman. One MAJOR problem, though...
[12-09-1999]
More by this Author [3/4]
This version of more by this author takes into consideration that a story may have more than one author and in that scenario it should display suggested links for each of the authors independently. This is achieved by creating a loop that processes each author one at a time. If there is only one author, it will display the one like before, but if there are multiple, it will list them out one after the other.
T A G C O D E:
<dpLoop var="i" from="1" to="<dpAuthor return="count">">
<dpQuery issue="archives" author="<dpAuthorID number="<dpVar i>">" max="3">
<b>More by <dpAuthor number="<dpVar i>">:</b><p>
<dpLoop>
<dpHeadline link="on"><br>
<dpSummary>
<font size="2">[<dpIssueDate begin="%m-%d-%Y">]</font>
<p>
</dpLoop>
<p><br>
</dpQuery>
</dpLoop>
E F F E C T:
More by Phil Campbell:
Of Rags and Riches
[11-18-1999]
Facing the Mob
[11-11-1999]
One Step Forward...
[11-11-1999]
More by Josh Feit:
Windows for Unions
[11-18-1999]
Last Train to Debtsville
Light rail planning gets heavy as Schell gets pissy and wants to borrow more money. By JOSH FEIT
[11-11-1999]
Seattle Weekly Up for Sale
[09-30-1999]
More by Jennifer Vogel:
Sliced Eyeballs
[10-28-1999]
A D D I T I O N A L I N F O R M A T I O N:
To explain this in more detail, let's first examine what the loop does by simplifying it a bit. The loop is defined as being a number from "1" to the amount of authors a story has. If the story has 3 authors, it will loop three times (from 1 to 3). The variable "i" will contain the loop number it is currently on. Here's what it would look like if you had 3 authors on a story.
All authors: <dpAuthor><br>
<dpLoop var="i" from="1" to="<dpAuthor return="count">">
Author <dpVar i>: <dpAuthor number="<dpVar i>"><br>
</dpLoop>
The default setting for <dpAuthor> is <dpAuthor number="all"> which displays all the authors of a story. By setting the number value to a literal like number="2", we are able to extract the second author only.
The full version of this query uses this principle to run the query once per author, taking special care that the appropriate author is referenced within the query itself.
More by this Author [4/4]
This example picks up where the previous left off and adds an enhancement of testing to see if the author had more then 3 stories. If she/he did, a link is inserted to link them to an author archive for their complete list. This author archive would be something you would have created using the <dpSpawn> tag.
This test is achieved by performing another query about the author, but this time only returning the "count" of how many matches the query made. This is then compared to see if it is greater than 3 and if so, the more link is added.
T A G C O D E:
<dpLoop var="i" from="1" to="<dpAuthor return="count">">
<dpQuery issue="archives" author="<dpAuthorID number="<dpVar i>">" max="3">
<b>More by <dpAuthor number="<dpVar i>">:</b><p>
<dpLoop>
<dpHeadline link="on"><br>
<dpSummary>
<font size="2">[<dpIssueDate begin="%m-%d-%Y">]</font>
<p>
</dpLoop>
<dpIf <dpQuery issue="all" author="<dpAuthorID number="<dpVar i>">" return="count"> gt 3>
<a href="../archives/<dpAuthorID number="<dpVar i>">.html">more...</a>
</dpIf>
<p><br>
</dpQuery>
</dpLoop>
E F F E C T:
More by Phil Campbell:
Of Rags and Riches
[11-18-1999]
Facing the Mob
[11-11-1999]
One Step Forward...
[11-11-1999]
More by Josh Feit:
Windows for Unions
[11-18-1999]
Last Train to Debtsville
Light rail planning gets heavy as Schell gets pissy and wants to borrow more money. By JOSH FEIT
[11-11-1999]
Seattle Weekly Up for Sale
[09-30-1999]
More by Jennifer Vogel:
Sliced Eyeballs
[10-28-1999]
Recently in this Column
The following query searches through all of the archives looking for additional stories previously in this column. If matches are found it will display the output and return a maximum of 3 links. If no matches are found, nothing will be displayed.
T A G C O D E:
<dpQuery issue="archives" column="this" max="3">
<b>Recently in <dpColumn>:</b><p>
<dpLoop>
<dpHeadline link="on"><br>
<dpSummary>
<font size="2">[<dpIssueDate begin="%m-%d-%Y">]</font>
<p>
</dpLoop>
</dpQuery>
E F F E C T:
Recently in I, Anonymous:
Drop the Chalupa
I am sick to the guillotines in regards to that spoiled Chihuahua on TV. Did you know they use irritants for the mouth motion? Would you like to know what else makes me sick?!?
[11-18-1999]
Mumia Shmoomia
To the zealots who staged the "Free Mumia" protest rally that clogged up Third and Fourth Avenue during rush hour on Friday, October 22nd
[11-11-1999]
Rookie of the Year
Hey NFL Rookie! You know you hurt me, right?
[11-04-1999]
Using the Exclude Attribute
The exclude attribute is most commonly used when you have a few groupings of suggested links, and want to make sure their is no redundancy. For example, if you had "previously in this column", and "recently by this author", there could be the same links listed in both places. Here's how you prevent that.
T A G C O D E:
Before:
<dpQuery issue="archives" column="this" max="3">
<b>Previously in <dpColumn>:</b><br>
<dpLoop>
<dpHeadline link="on"><br>
</dpLoop>
</dpQuery>
<dpQuery issue="archives" author="this" max="3">
<b>Recently by <dpAuthor>:</b><br>
<dpLoop>
<dpHeadline link="on"><br>
</dpLoop>
</dpQuery>
After:
<dpQuery issue="archives" column="this" max="3">
<b>Previously in <dpColumn>:</b><br>
<dpLoop>
<dpHeadline link="on"><br>
</dpLoop>
</dpQuery>
<dpQuery issue="archives" author="this" max="3" exclude="<dpQuery issue="archives" column="this" max="3">">
<b>Recently by <dpAuthor>:</b><br>
<dpLoop>
<dpHeadline link="on"><br>
</dpLoop>
</dpQuery>
E F F E C T:
Before:
Previously in Music:
MP3s Basically Suck
Heat Seeking
Shaolin Slangmaster
Recently by Erin Franzman:
MP3s Basically Suck
Welcome
Going Underground
After:
Previously in Music:
MP3s Basically Suck
Heat Seeking
Shaolin Slangmaster
Recently by Erin Franzman:
Welcome
Going Underground
If You Don't Have Anything Nice to Say, Tell the Truth Anyway
A D D I T I O N A L I N F O R M A T I O N:
Notice the exclude attribute in the second query. This exclude lists a query of results you want to exclude, like a subset. In this case, it excludes any result that would have been in the query before it.
Suggested Links Within a Drop-down menu (Select)
Say you want to list your suggested links in a drop-down menu, rather then on the page itself. You would do this simply by adding the appropriate form elements to the query, so that Dispatch can build the form. Note: this version requires JavaScript.
T A G C O D E:
<form onSubmit="document.location.href=myNav.options[myNav.options.selectedIndex].value; return false">
<select name="myNav">
<dpQuery issue="archives" column="this" max="20">
<option value="../<dpIssue>/<dpFile>"><dpHeadline>
</dpQuery>
</select>
<input type="submit" value="go">
</form>
E F F E C T:
Other Music Reviews in this Issue [1/2]
Say you want to chain stories of the same column together within an issue, like all of the music reviews. Here's how you would achieve that.
T A G C O D E:
Hard coded version:
<dpQuery issue="this" column="music_reviews">
<b>More Music Reviews in this issue:</b><br>
<dpLoop>
<dpHeadline link="on"><br>
</dpLoop>
</dpQuery>
More dynamic version:
<dpQuery issue="this" column="this">
<b>More <dpColumn> in this issue:</b><br>
<dpLoop>
<dpHeadline link="on"><br>
</dpLoop>
</dpQuery>
E F F E C T:
More Music Reviews in this issue:
Conceptual Chaos
The Shirt Off Your Back
Shamrocks and Glocks
Jones on the Jukebox
CD Review Revue
Other Music Reviews in this Issue [2/2]
In this example, we will have two queries. One to connect to other music reviews in the issue the reader is reading, and a second query to recent record reviews. This is an interesting way to provide two directional navigation.
T A G C O D E:
<dpQuery issue="this" column="music">
<b>More Music Reviews in this issue:</b><br>
<dpLoop>
<dpHeadline link="on"><br>
</dpLoop>
<p>
</dpQuery>
<dpQuery issue="archives" column="music" max="5">
<b>Recent Music Reviews:</b><br>
<dpLoop>
<dpHeadline link="on"> <font size="2">[<dpIssueDate begin="%m-%d-%Y">]</font><br>
</dpLoop>
</dpQuery>
E F F E C T:
More Music Reviews in this issue:
Conceptual Chaos
The Shirt Off Your Back
Shamrocks and Glocks
Jones on the Jukebox
CD Review Revue
Recent Music Reviews:
MP3s Basically Suck [02-03-2000]
Heat Seeking [02-03-2000]
Shaolin Slangmaster [02-03-2000]
The Last Classic Rock Band [01-27-2000]
Utilizing the Usage [01-27-2000]
Listing All Columns With Realm
The following will query over all your issues to find all the unique columns in your database. The realm attribute and value of "column" limits this query to only one result per column.
T A G C O D E:
<dpQuery issue="all" realm="column">
<dpColumn><br>
</dpQuery>
E F F E C T:
News Index
City
In Other News...
Police Beat
Last Days
Columns Index
Savage Love
I Love Television
This Week on TV
etc...
A D D I T I O N A L I N F O R M A T I O N:
To make the list more readable, you can also add sort="column" to sort by the column name.
<dpQuery issue="all" realm="column" sort="column">
<dpColumn><br>
</dpQuery>
All Ages Action
Art
Arts Index
Big Cover
Book Review Revue
Book Supplement
Books
Calendar Index
CD Review Revue
Celeb
Chow
City
City of Paris
Club Directory
etc...
Querying by Issue Volume and/or Issue Number
You can list all of stories from a single volume number by querying over all of your issues to finding matches for the specific volume number.
T A G C O D E:
<dpQuery issue="all" volumeNumber="8">
<dpHeadline link="on"><br>
</dpQuery>
Or perhaps you only want volume number 8 and issue numbers 4 and 6:
<dpQuery issue="all" volumeNumber="8" issueNumber="4" issueNumber="6">
<dpHeadline link="on"><br>
</dpQuery>
E F F E C T:
Preventing Interstitials from showing up in Queries
By default both interstitials and columns will show up in queries. You can override this default using the columnType attribute.
The following will limit results to columns only, thus preventing interstitials from showing up:
T A G C O D E:
<dpQuery issue="this" columnType="column">
<dpHeadline link="on"><br>
</dpQuery>
E F F E C T:
A D D I T I O N A L I N F O R M A T I O N:
The following will do the opposite and only return interstitials in the results:
<dpQuery issue="this" columnType="interstitial">
<dpHeadline link="on"><br>
</dpQuery>
And the default columnType setting will return both insterstitials and columns:
<dpQuery issue="this" columnType="all">
<dpHeadline link="on"><br>
</dpQuery>
Fuzzy and Fuzzier: Part 1
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...
E F F E C T:
Fuzzy and Fuzzier: Part 2
In Part 1, we saw how you can use sort="fuzzy" and sort="fuzzier" to find suggested links based on a user field match. In this part we discuss how to fine tune this process.
T A G C O D E:
We have showed queries like this:
Suggested Links:<br>
<dpQuery issue="archives" userField="film genre" sort="fuzzy" max="5">
<dpHeadline link="on"> (<dpUserField name="film genre" number="all">)<br>
</dpQuery>
instead of this:
<dpQuery issue="archives" userField="film genre" sort="fuzzy" max="5">
Suggested Links:<br>
<dpLoop>
<dpHeadline link="on"> (<dpUserField name="film genre" number="all">)<br>
</dpLoop>
</dpQuery>
The reason we are doing this is for ease of readability. When you actually use these queries we always recommend using the latter version with the <dpLoop>. Why? Mainly because of the "Suggested Links:" header. In the first example, the suggested links header will always display regardless of whether any matches are found. The second version will only display the suggested links header if the query is successful. This is a much better approach and the recommended version.
-------
Now, back to sort="fuzzy".
Let's look at the example of matching film genres for a film that may have few genres associated with it:
<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>
This could return results like this for the film "I Love You to Death" which is just a comedy.
I Love You to Death (Comedy)
Suggested Links:
The Flim-Flam Man (Comedy)
The Muse (Comedy)
The Ruling Class (Comedy)
The Producers (Comedy)
Bicentennial Man (Comedy)
Granted, those matches are of other comedy films, but they are all over the map and don't necessarily have anything in common with "I Love You to Death" outside of also being funny.
Here's how we can improve the match...
--------
Our examples so far have used only one user field, however our demo publication, Baltimore CityPaper, catalogs a lot more rich meta information about their film reviews, such as film stars (actors), and film directors. Using this additional information, we can refine our query:
<dpQuery issue="archives" userField="film genre" userField="film director" userField="film stars" sort="fuzzy" max="5">
Here it is with all the additional debugging information, so we analyze the results:
<dpHeadline>
(<dpUserField name="film genre" number="all">)
(<dpUserField name="film director" number="all">)
(<dpUserField name="film stars" number="all">)
<p>
Suggested Links:<br>
<dpQuery issue="archives" userField="film genre" userField="film director" userField="film stars" sort="fuzzy" max="5">
<dpHeadline link="on">
(<dpUserField name="film genre" number="all">)
(<dpUserField name="film director" number="all">)
(<dpUserField name="film stars" number="all">)<br>
</dpQuery>
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)
"I Love You to Death" is a comedy directed by Lawrence Kasden starring Kevin Kline, Tracey Ullman, River Phoenix. Using all of this information, the sort="fuzzy" was able to group the best matches first.
"Mumford" is also a comedy by the same director.
"The January Man" is also a comedy starring Kevin Kline.
The rest are looser matches, but you can see as a database becomes more populated, you have the ability to link to the best matches first.
Next, further refinements for multiple user field matches....
E F F E C T:
Fuzzy and Fuzzier: Part 3
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.
E F F E C T:
| Home: Support: Reference Guide: Queries: <dpQuery> | Questions? Comments? Please write support@desert.net. |