Template:Searchnews2: Difference between revisions

Jump to navigation Jump to search
No edit summary
No edit summary
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>{{#dpl:
<includeonly>{{#switch: {{#if:{{{find|}}}|text|{{#if:{{{title|}}}|title|neither}}}}
category=Published{{#if:{{{prevmon|}}}|&Category={{#time:F Y|01-{{CURRENTMONTH}}-{{CURRENTYEAR}} -{{{prevmon}}} months}}}}{{#if:{{{prevyear|}}}|&Category={{#time:Y|01-{{CURRENTMONTH}}-{{CURRENTYEAR}} -{{{prevyear}}} years}}}}
| #default = {{#dpl:debug=0
|debug=0
|category=Published{{#if:{{{prevmon|}}}|&{{#time:F Y|01-{{CURRENTMONTH}}-{{CURRENTYEAR}} -{{{prevmon}}} months}}}}{{#if:{{{prevyear|}}}|&{{#time:Y|01-{{CURRENTMONTH}}-{{CURRENTYEAR}} -{{{prevyear}}} years}}}}{{#if:{{{year|}}}|&{{{year}}}}}{{#if:{{{cat|}}}|&{{{cat}}}}}
|allowcachedresults={{#if:{{{cacheresults|}}}|{{{cacheresults}}}|true}}
|allowcachedresults={{#if:{{{cacheresults|}}}|{{{cacheresults}}}|true}}
|namespace=News
|notcategory=Disputed
|notcategory=Not_published
|shownamespace=false
|ordermethod=sortkey
|order=descending
|addauthor=false
|reset=categories
|mode=userformat
|format  = ,,,
|noresultsheader=* (no results - default)
|distinct=true
|resultsheader=
|include={newsarticle}.dplsearch,{newstitle}.dpl
|count={{#if:{{{numarticles|}}}|{{{numarticles}}}|200}}
}}
|text = {{#dpl:debug=0
|category=Published{{#if:{{{prevmon|}}}|&{{#time:F Y|01-{{CURRENTMONTH}}-{{CURRENTYEAR}} -{{{prevmon}}} months}}}}{{#if:{{{prevyear|}}}|&{{#time:Y|01-{{CURRENTMONTH}}-{{CURRENTYEAR}} -{{{prevyear}}} years}}}}{{#if:{{{year|}}}|&{{{year}}}}}{{#if:{{{cat|}}}|&{{{cat}}}}}
|allowcachedresults={{#if:{{{cacheresults|}}}|{{{cacheresults}}}|true}}
|namespace=News
|notcategory=Disputed
|notcategory=Not_published
|uses=Template:Newstitle
|uses=Template:Newstitle
|shownamespace=false
|ordermethod=sortkey
|order=descending
|addauthor=false
|reset=categories
|mode=userformat
|format  = ,,,
|noresultsheader=* (no results)
|distinct=true
|resultsheader=
|include={newsarticle}.dplsearch,{newstitle}.dpl
|count={{#if:{{{numarticles|}}}|{{{numarticles}}}|50}}
|includematch=/({{{find|}}}{{ #foreach: find$n$ |{{!}}{{{find$n$}}}}})/si
}}
| title = {{#dpl:debug=0
|category=Published{{#if:{{{prevmon|}}}|&{{#time:F Y|01-{{CURRENTMONTH}}-{{CURRENTYEAR}} -{{{prevmon}}} months}}}}{{#if:{{{prevyear|}}}|&{{#time:Y|01-{{CURRENTMONTH}}-{{CURRENTYEAR}} -{{{prevyear}}} years}}}}{{#if:{{{year|}}}|&{{{year}}}}}{{#if:{{{cat|}}}|&{{{cat}}}}}
|titlematch=%{{{title}}}%{{ #foreach: title$n$ |{{!}}%{{{title$n$}}}%}}
|allowcachedresults={{#if:{{{cacheresults|}}}|{{{cacheresults}}}|true}}
|namespace=News
|namespace=News
|notcategory=Disputed
|notcategory=Disputed
Line 12: Line 52:
|addauthor=false
|addauthor=false
|reset=categories
|reset=categories
|addfirstcategorydate=true
|userdateformat=Y-m-d (D)
|mode=userformat
|mode=userformat
|format  = ,,,
|format  = ,,,
|noresultsheader=* (no results - search [[:Category:Published|all news]])
|noresultsheader=* (no results)
|distinct=true
|distinct=true
|resultsheader=
|resultsheader=
|include={newsarticle}.dplsearch,{newstitle}.dpl
|include={newsarticle}.dplsearch
|includematch=/({{#if:{{{find|}}}|{{{find}}}|.+?}}{{ #foreach: find$n$ |{{!}}{{{find$n$}}}}})/si
|count={{#if:{{{numarticles|}}}|{{{numarticles}}}|200}}
|count={{#if:{{{numarticles|}}}|{{{numarticles}}}|200}}
}}</includeonly>
}}}}</includeonly><noinclude>
 
= parameters =
=== selection ===
* find=PCI | find1=STEMI | find2=... : search news titles + summaries (note: db intensive, please limit numarticles)
* title=PCI | title1=STEMI | title2=... : search news titles only (*much* less db intensive)
* cat=January 2009 : list articles from Jan 2009
* year=#### : list articles published in year ####, starting with most recent (use 4 digits)
* prevmon=# : list articles published so many months ago, as displayed on [[:Category:Published]]
* prevyear=# : list articles published so many years ago, as displayed on [[:Category:Published]]
'''NOTE:''' time limiters & searches can be combined -- this is a good way to limit results. EX, you could say
:<pre><nowiki>{{searchnews2|prevmon=0|title=PCI}}  <-- search within the last month's news</nowiki></pre>
 
=== output volume / efficiency ===
* numarticles=# : number of articles to display (for title searching, it will be this number. For text searching, search is conducted ''within'' this number of most recent articles.
* cacheresults (true or false, defaults to true) : whether it's OK to use data up to an hour old
 
 
 
 
= Examples =
:<pre><nowiki>{{searchnews2|prevmon=0|title=PCI}}  <-- search titles within the last month's news</nowiki></pre>
 
:<pre><nowiki>{{searchnews2|prevmon=0|find=PCI|find1=STEMI|find2=stent}}  <-- search text within the last month's news</nowiki></pre>
 
= Misc comments =
* As noted elsewhere, search terms for 'find' params are case insensitive. Titles are not. See [[:Template:Searchnews]] for more info on this.
* This is slightly modified from [[:Template:Searchnews]] which limits display articles to 5, irrespective of the articlenum param. Searchnews also doesn't give the option of searching by year and/or title.
* As in Searchnews & Listnews, the control of the display is dictated by [[:Template:Newsarticle.dplsearch]]
 
= See also =
* [[:Template:Searchnews]]
* [[:Template:Listnews]]
* [[:Template:Dailynews]]
* [[:Template:Weeklynews]]
 
 
 
</noinclude>

Latest revision as of 03:15, 20 February 2009


parameters

selection

  • find=PCI | find1=STEMI | find2=... : search news titles + summaries (note: db intensive, please limit numarticles)
  • title=PCI | title1=STEMI | title2=... : search news titles only (*much* less db intensive)
  • cat=January 2009 : list articles from Jan 2009
  • year=#### : list articles published in year ####, starting with most recent (use 4 digits)
  • prevmon=# : list articles published so many months ago, as displayed on Category:Published
  • prevyear=# : list articles published so many years ago, as displayed on Category:Published

NOTE: time limiters & searches can be combined -- this is a good way to limit results. EX, you could say

{{searchnews2|prevmon=0|title=PCI}}  <-- search within the last month's news

output volume / efficiency

  • numarticles=# : number of articles to display (for title searching, it will be this number. For text searching, search is conducted within this number of most recent articles.
  • cacheresults (true or false, defaults to true) : whether it's OK to use data up to an hour old



Examples

{{searchnews2|prevmon=0|title=PCI}}  <-- search titles within the last month's news
{{searchnews2|prevmon=0|find=PCI|find1=STEMI|find2=stent}}  <-- search text within the last month's news

Misc comments

  • As noted elsewhere, search terms for 'find' params are case insensitive. Titles are not. See Template:Searchnews for more info on this.
  • This is slightly modified from Template:Searchnews which limits display articles to 5, irrespective of the articlenum param. Searchnews also doesn't give the option of searching by year and/or title.
  • As in Searchnews & Listnews, the control of the display is dictated by Template:Newsarticle.dplsearch

See also