Breaking

Wednesday, April 22, 2020

How to use typo3 extension Indexed Search Engine in typo3 9.5.13 with custom search form design integration ?








Indexed searched is great extension of typo3, I would like to teach you how to use indexed search in typo3 9.5.13 

First enable extension if not enable from typo3 extension manager 



Now include typoscript of indexed search 


Now add Typo3 plugin search result element in result page







Now custom design form adaption 

In your html header section you need to add code as fluid template . search code form is below save file as indexsearch.html in your extension or fileadmin 

<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
    <f:form action="search" method="post" controller="Search" extensionName="indexedsearch" pluginName="pi2" pageUid="{settings.targetPid}">
        <f:form.textfield name="search[sword]" value="{sword}" placeholder="Enter your search term..." class="sb-search-input quicksearch-sword" />
        <f:form.submit name="search[submitButton]" value="" class="sb-search-submit quicksearch-submit" />
<span class="sb-icon-search" title="Click to start searching"></span>
    </f:form>
</html>

Now include typoscript 

<INCLUDE_TYPOSCRIPT: source="FILE:EXT:your_extension/Configuration/TypoScript/indexedsearch/constants.typoscript">

plugin.tx_indexedsearch {
view {
# cat=plugin.tx_indexedsearch/file; type=string; label=Path to template root (FE)
templateRootPath = EXT:your_extension/Resources/Private/Templates/Extension/IndexedSearch/Templates/
# cat=plugin.tx_indexedsearch/file; type=string; label=Path to template partials (FE)
partialRootPath = EXT:your_extension/Resources/Private/Templates/Extension/IndexedSearch/Partials/
# cat=plugin.tx_indexedsearch/file; type=string; label=Path to template layouts (FE)
layoutRootPath = EXT:your_extension/Resources/Private/Templates/Extension/IndexedSearch/Layouts/
}
settings {
# cat=plugin.tx_indexedsearch/settings; type=integer; label=Set the target page where search results are shown
targetPid = 28
# cat=plugin.tx_indexedsearch/settings; type=string; label=A list of integer which should be root-pages to search from
rootPidList = 1
}
}

in constant past your indexed search path and past files from core indexed search to your location 

Note : by setup.typoscript you can enable disable advanced setting 

<INCLUDE_TYPOSCRIPT: source="FILE:EXT:your_extension/Configuration/TypoScript/indexedsearch/setup.typoscript">


config.index_enable = 1
config.index_externals = 1
config.index_metatags = 1

 # Plugin configuration
plugin.tx_indexedsearch {

settings {
targetPid = {$plugin.tx_indexedsearch.settings.targetPid}
# show the rules
displayRules = 0

# show a link to the advanced search
displayAdvancedSearchLink = 0

# show the number of results
displayResultNumber = 0

breadcrumbWrap = / || /

# show the parse times
displayParsetimes = 0
displayLevel1Sections = 1
displayLevel2Sections = 0
displayLevelxAllTypes = 0
displayForbiddenRecords = 0
alwaysShowPageLinks = 1
mediaList =

rootPidList = {$plugin.tx_indexedsearch.settings.rootPidList}
page_links = 10
# @deprecated left for BC reasons, will be removed in 10
detectDomainRcords = 0
detectDomainRecords < .detectDomainRcords
defaultFreeIndexUidList =
searchSkipExtendToSubpagesChecking = 0
exactCount = 0
forwardSearchWordsInResultLink = 0
forwardSearchWordsInResultLink.no_cache = 1

# various crop/offset settings for single result items
results {
titleCropAfter = 50
titleCropSignifier = ...
summaryCropAfter = 1200
summaryCropSignifier = 1200
hrefInSummaryCropAfter = 60
hrefInSummaryCropSignifier = ...
markupSW_summaryMax = 600
markupSW_postPreLgd = 60
markupSW_postPreLgd_offset = 5
markupSW_divider = ...
markupSW_divider.noTrimWrap = | | |
pathExcludeDoktypes =
}

# Blinding of option-selectors / values in these (advanced search)
blind {
searchType = 0
defaultOperand = 0
sections = 0
freeIndexUid = 1
mediaType = 0
sortOrder = 0
group = 0
languageUid = 0
desc = 0
# List of available number of results. First will be used as default.
numberOfResults = 10,25,50,100
# defaultOperand.1 = 1
# extResume=1
}
/*
flagRendering = CASE
flagRendering {
key.current = 1
2 = TEXT
2.value = German
default = TEXT
default.value = English
}

iconRendering = CASE
iconRendering {
key.current = 1
html = TEXT
html.value = HtmL
default = TEXT
default.value = TYPO3 pages
}

specialConfiguration {
0.pageIcon = IMAGE
0.pageIcon.file = typo3/sysext/indexed_search/Resources/Public/Icons/FileTypes/pages.gif
1.pageIcon = IMAGE
1.pageIcon.file = typo3/sysext/indexed_search/Resources/Public/Icons/FileTypes/pdf.gif
}
*/
defaultOptions {
defaultOperand = 0
sections = 0
freeIndexUid = -1
mediaType = -1
sortOrder = rank_flag
languageUid = current
sortDesc = 1
searchType = 1
extResume = 1
}

}


view {
templateRootPaths {
0 = EXT:your_extension/Resources/Private/Templates/Extension/IndexedSearch/Templates/
10 = {$plugin.tx_indexedsearch.view.templateRootPath}
}
partialRootPaths {
0 = EXT:your_extension/Resources/Private/Templates/Extension/IndexedSearch/Partials/
10 = {$plugin.tx_indexedsearch.view.partialRootPath}
}
layoutRootPaths {
0 = EXT:your_extension/Resources/Private/Templates/Extension/IndexedSearch/Layouts/
10 = {$plugin.tx_indexedsearch.view.layoutRootPath}
}
}
}


lib.quicksearch = FLUIDTEMPLATE
lib.quicksearch{
    file = fileadmin/IndexSearch.html
    settings.targetPid = {$plugin.tx_indexedsearch.settings.targetPid}
}

Now past lib.quicksearch object in partial header 

<div class="top">
<div class="container">
<div class="row">
<div class="col-md-6">
<ul class="topleft-info">
<li><i class="fa fa-phone"></i><f:cObject typoscriptObjectPath="lib.phoneno" /></li>
</ul>
</div>
<div class="col-md-6">
<div id="sb-search" class="sb-search">
<f:cObject typoscriptObjectPath="lib.quicksearch" />
</div>
</div>
</div>
</div>

</div> 

Note : you can use your_extension path or fileadmin path , past core template files of indexed search like template, layout, partial to your extension and as path set above 

Now save and visit each page in browser and check page being indexed or not 



 Thank you for visit my blog 

No comments:

Post a Comment

your suggestion are welcome by me