Searchwords are loaded into the register in a form ready for linking to pages:
register:SWORD_PARAMS = '&sword_list[]=word1&sword_list[]=word2 .....'
See typolink for more info!
SEARCHRESULT returns results only from pages with of doktype "Standard" (1), "Advanced" (2) and "Not in menu" (5)
Property: | Data type: | Description: | Default: |
|---|---|---|---|
allowedCols | string | List (separated by ":") of allowed table-cols. Example: pages.title:tt_content.bodytext | |
layout | string | This defines how the search content is shown. Example: This substitutes the following fields: ###RANGELOW###:The low result range, eg. "1" ###RANGEHIGH###:The high result range, eg. "10" ###TOTAL###:The total results ###RESULT###:The result itself ###NEXT###:The next-button ###PREV###:The prev-button | |
next | cObject | This cObject will be wrapped by a link to the next searchresult. This is the code substituting the "###NEXT###"-mark | |
prev | cObject | This cObject will be wrapped by a link to the prev searchresult. This is the code substituting the "###PREV###"-mark | |
target | target | target til next/prev links! | |
range | int | The number of results at a time! | 20 |
renderObj | cObject | the cObject to render the searchresults $cObj->data array is set to the resulting record from the search. Please note, that in all fields are named [tablename]_[fieldnam]. Thus the pagetitle is in the field "pages_title". Apart from this, these fields from the pages-table are also present: uid | |
renderWrap | wrap | ||
resultObj | cObject | the cObject prepended in the search results returns rows | |
noResultObj | cObject | the cObject used if the search results in no rows. | |
noOrderBy | boolean | If this is set, the result is NOT sorted after lastUpdated, tstamp for the pages-table. | |
wrap | wrap | Wrap the whole content... | |
stdWrap | ->stdWrap | Wrap the whole content... | |
addExtUrlsAndShortCuts | boolean | If set, then the doktypes 3 and 4 (External URLS and Shortcuts) are added to the doktypes being searched. However at this point in time, no pages will be select if they do not have at least one tt_content record on them! That is because the pages and tt_content (or other) table is joined. So there must at least one occurance of a tt_content element on a External URL / Shortcut page for them to show up. | |
languageField.[2nd table] | string | Setting a field name to filter language on. This works like the “languageField” setting in ->select Example: languageField.tt_content = sys_language_uid |
[tsref:(cObject).SEARCHRESULT]
NOTE: "sword" and "scols" MUST be set in order for the search to be engaged.
var "sword" = search word(s)
var "scols" = search columns separated by ":". Eg:pages.title:pages.keywords:tt_content.bodytext
var "stype" = the starting point of the search:false = current page, L-2 = page before currentPage, L-1 = current page, L0 = rootlevel, L1 = from first level, L2 = from second level
var $GLOBALS["HTTP_POST_VARS"]["locationData"]: If this is set, the search is done as was it from another page in the website given by the value of "locationData" here. See the description at the cObject "FORMS".
Only if the page locationData is pointing to, is inside the real rootLine of the site, the search will take this into account.
internal:
var "scount": If this is set this is used as the searchCount - the total rows in the search. This way we don't need to reconstruct this number!
var "spointer": This points to the start-record in the search.
LATER:
var "alldomains" :boolean: If set the search will proceed into other domains
var "allsites" : boolean: If set the search will proceed into other sites (defined by the "root" setting of an active template.)
var "depth":The depth
When you search, you can use three operatortypes
AND: "+", "and" (UK), "og" (DK)
OR: "or" (UK), "eller" (DK)
NOT: "-", "not" (UK), "uden" (DK)
Default operator is AND. If you encapsulate words in "" they are searched for as a whole string. The search is case insensitive and matches parts of words also.
In this case "pagecontent" is chosen as the fields to search. That includes tt_content.header, tt_content.bodytext and tt_content.imagecaption.
Prefixed to these queries is this:
SELECT pages.title AS pages_title, pages.subtitle AS pages_subtitle, pages.keywords AS pages_keywords, pages.description AS pages_description, pages.uid, tt_content.header AS tt_content_header, tt_content.bodytext AS tt_content_bodytext, tt_content.imagecaption AS tt_content_imagecaption FROM pages, tt_content WHERE(tt_content.pid=pages.uid) AND (pages.uid IN (2,5,6,20,21,22,29,30,31,3,4,8,9,16,1) AND pages.doktype in (1,2,5) AND pages.no_search=0 AND NOT tt_content.deleted AND NOT tt_content.hidden AND (tt_content.starttime<=985792797) AND (tt_content.endtime=0 OR tt_content.endtime>985792797) AND tt_content.fe_group IN (0,-1) AND NOT pages.deleted AND NOT pages.hidden AND (pages.starttime<=985792797) AND (pages.endtime=0 OR pages.endtime>985792797) AND pages.fe_group IN (0,-1)) ...
The part "... pages.uid IN (2,5,6,20,21,22,29,30,31,3,4,8,9,16,1)... " is a list of pages-uid's to search. This list is based on the page-ids in the website-branch of the pagetree and confines the search to that branch and not the whole page-table.
... AND ((tt_content.header LIKE '%menu%' OR tt_content.bodytext LIKE '%menu%' OR tt_content.imagecaption LIKE '%menu%') AND (tt_content.header LIKE '%backend%' OR tt_content.bodytext LIKE '%backend%' OR tt_content.imagecaption LIKE '%backend%')) GROUP BY pages.uid
... AND ((tt_content.header LIKE '%menu backend%' OR tt_content.bodytext LIKE '%menu backend%' OR tt_content.imagecaption LIKE '%menu backend%')) GROUP BY pages.uid
... AND ((tt_content.header LIKE '%menu%' OR tt_content.bodytext LIKE '%menu%' OR tt_content.imagecaption LIKE '%menu%') OR (tt_content.header LIKE '%backend%' OR tt_content.bodytext LIKE '%backend%' OR tt_content.imagecaption LIKE '%backend%')) GROUP BY pages.uid
... AND ((tt_content.header LIKE '%menu%' OR tt_content.bodytext LIKE '%menu%' OR tt_content.imagecaption LIKE '%menu%') OR (tt_content.header LIKE '%backend%' OR tt_content.bodytext LIKE '%backend%' OR tt_content.imagecaption LIKE '%backend%') AND NOT (tt_content.header LIKE '%content%' OR tt_content.bodytext LIKE '%content%' OR tt_content.imagecaption LIKE '%content%')) GROUP BY pages.uid
Notice that upper and lowercase does not matter. Also 'menu' as searchword will find 'menu', 'menus', 'menuitems' etc.