Search demo

From Discourse DB
Jump to navigation Jump to search

The following queries demonstrate the abilities of the text searching feature in Cargo, available since version 1.0.

All queries are limited to 5 results, as viewable in the #cargo_query calls.

Basic text search

Gets all pages containing the word 'gates'.

Query:

{{#cargo_query:table=_pageData
|fields=_pageName=Page,_fullText=Search results
|where=_fullText MATCHES 'gates'
|limit=5}}

Results:

Page Search results
A Bush Retreat? 421728718013.html |quote="Mr. Gates is a capable public servant with broad security experience. But much of that experience is with the ...
Anatomy of a Wrong Approach should hold Bush and Defense Secretary Robert Gates strictly to account for monitoring the action -- or inaction -- of the Maliki government." ...
Aye, Spy ion/15deutch.html |quote="Mr. Gates is an experienced Washington hand with the right temperament to change the administration’s thinking ...
Bush's Border Buffoonery (and to leave the country through the same gates)." Illegal immigration to the United States|United States should build a fence along Mexican ...
Confirm intelligence point of these hearings is not to rehash Gates' past. It is to establish ... Nomination of Robert Gates as U.S. Secretary of Defense|Gates was ...

More...

Text search with category query

Gets all pages with the word 'circulation' in the category Magazines.

Query:

{{#cargo_query:table=_pageData
|fields=_pageName=Magazine,_fullText=Search results
|where=_categories HOLDS 'Magazines' AND _fullText MATCHES 'circulation'
|limit=5}}

Results:

Magazine Search results
Human Events circulation=78,000| country=United States| language=English| url=http://www.humanevents.com/ ...
National Review circulation=160,000 |country=United States |language=English |url=http://www.nationalreview.com/ ...
New York Review of Books circulation=140,000 |country=United States |language=English |url=http://www.nybooks.com/ ...
Newsweek circulation=3,160,000 |country=United States |language=English |url=http://www.newsweek.com/ ...
Reason circulation=60,000 |country=United States |language=English |url=http://www.reason.com/ ...

More...

Compound search

Gets all opinion items containing the words 'george bush' published after 2009 (i.e., after U.S. President George W. Bush left office).

This query demonstrates a number of features:

  • Joining the page data table with a standard Cargo table
  • Querying and displaying data from both tables
  • A more complex search term (the term used is 'george +bush', not just 'george bush', to prevent results just containing the word "george"
  • Ordering on a field other than the page name (the date)

Query:

{{#cargo_query:tables=_pageData,Items
|join on=_pageData._pageName=Items._pageName
|fields=_pageData._pageName=Item,Items.Date,_fullText=Search results
|where=YEAR(Items.Date) > 2009 AND _fullText MATCHES 'george +bush'
|order by=Items.Date
|limit=5}}

Results:

Item Date Search results
Massachusetts for Palin? August 1, 2010 McGovern, but to Richard Nixon. Or to the first George Bush in 1988, instead of Michael Dukakis. Or to George W. Bush, not John Kerry, in 2004." ...
Bam's spending spree August 30, 2010 pushing hard against 10 percent. As Bush adviser Lawrence Lindsey wrote, "the actual performance of the economy is almost exactly what ...
A New START Treaty? No Deal November 17, 2010 Missile Treaty from which President George W. Bush withdrew in 2001. Gaffney notes that some senators worry the treaty "will effectively ...
Gaddafi has a long history as a killer — and must be stopped March 14, 2011 Kurds — to the everlasting shame of the inert George H.W. Bush. 2011 Libyan uprising|United States should impose a no-fly zone|for ...
'Victory' in Libya August 25, 2011 war was less excusable. In going after Saddam, Bush at least could claim to be defusing an ongoing threat to our allies, in a vital region. But Gadhafi ...

More...