Typo3 - indexed search
Extension einbinden
Indexed Search Engine (indexed_search)installieren (Standardmäßig vorhanden)
Translation Handling -> Übersetzungen aktualisieren
HTML-Template & CSS
Beispiel:
<div id="searchBox">
</div>
Einschränken des Suchbereichs im Template
Im Template werden folgende Marker eingesetzt:
<!--TYPO3SEARCH_begin--> ... <!--TYPO3SEARCH_end-->
Sind keine Marker vorhanden wird alles Durchsucht ist nur einer der Marker vorhanden wird alles nach (begin Marker) bzw. vor (end Marker) dem Marker durchsucht
CSS
#searchBox input{
width: 140px;
}
#searchBox input.searchBox-button{
position: relative;
border: none;
width: auto;
top: 2px;
}
div.tx-indexedsearch-whatis{
padding-left: 12px;
}
Konfiguration der Extension
TypoScript indexedSearch-config (V1.1)
Constants
searchRoot = 1 searchResultPage = 4 searchPic = fileadmin/common/images/lupe.gif
Setup
plugin.tx_indexedsearch._CSS_DEFAULT_STYLE >
page.config.index_enable = 1
config{
# Index-Suche einschalten
index_enable = 1
# Externe Dateien auch durchsuchen (pdf,doc...benötigt Erweiterungen)
index_externals = 0
}
plugin.tx_indexedsearch{
# Startpunkte der Suche (12,45...)
search.rootPidList = {$searchRoot}
# Diverse Optionen zur Anzeige im Frontend...
show.rules = 0
show.resultNumber = 0
blind.sections = 1
show.L1sections = 0
show.L2sections = 0
show.advancedSearchLink = 0
# auf bestimmte Medientypen einschränken
# search.mediaList = pdf, doc
}
# Temporäres Objekt für das Suchfeld (in neueren Versionen auch Templates möglich
# es kann auch die macina Searchbox eingesetzt werden (Template Support Mehrsprachigkeit...)
temp.searchBox = TEXT
temp.searchBox.insertData = 1
temp.searchBox.value (
<div class="searchBox">
<form action="index.php?id={$searchResultPage}&tx_indexedsearch[sword]" method="post">
<input type="text" name="tx_indexedsearch[sword]" value="Suche" class="searchBox-field" title="Suche" />
<input type="image" src="{$searchPic}" alt="Start" title="Start" class="searchBox-button"/>
<input type="hidden" name="stype" value="L0" />
<input type="hidden" name="scols" value="tt_content.header-bodytext-imagecaption" />
<input type="hidden" name="locationData" value="{$searchResultPage}:pages:{$searchResultPage}" />
</form>
</div>
)
#plugin.tx_macinasearchbox_pi1.pidSearchpage = {$searchResultPage}
im Main Template
Setup:
### SearchBox ### subparts.searchBox < temp.searchBox
Tutorial von Marlies Cohen
When I first started with Typo3 Indexed Search gave me some problems. It is a very basic extension.
Place this line of code in the Setup of your TypoScript of your rootpage:
# Indexed Search activated page.config.index_enable = 1
Now comes the trick to get your pages indexed.
-> Log out of Typo3
-> Go to your home page
-> Log back in to Typo3
-> Now your pages should be cached and searchable
The reason for this is that as long as you are logged in to Typo3 your pages are not cached, once you log out and view pages they are cached. Knowing this saves a lot of hassles.
Clearing Indexed Search Cache
-> switch to the "Info" module on the left and
-> choose "indexed search" on the right dropdown (in the details view). now you can see all your pages that have been indexed
-> click on the trash-item to delete the indexed record for a specific page-tree (attention: recursive!).