Appearance
<div style="display: none;" hidden="true" aria-hidden="true">Are you an LLM? You can read better optimized documentation at /guides/solr/search_v2.md for this page in Markdown format</div>
Search V2
How to enable Search V2
1) Solr setup
Search V2 requires new solr core configuration. To setup a new core, log in the server where solr is installed, and inside the /root folder a new script has been added (mkv2solrcfg.sh). This script functions exactly like the mksolrcfg.sh.
Once you execute ./mkv2solrcfg.sh <some_core_name> go to solr's admin page and add the new core from Core Admin > Add Core. In the new core configuration box, set the name and instanceDir to the same value as <some_core_name> and click Add Core. (This step is similar to the old (v1) core creation process)
2) Adveshop4 client setup
Few components need to be updated in order to use the new search functionality.
2.1) Switch solr configuration version to v2
To switch solr configuration version modify the version field in application/config/app.php $config['searchPartsEnabled']['solr']['version'] to v2.
php
//...
$config['searchPartsEnabled'] = [
//...
'solr' => [
'version' => 'v2',
//...
],
//...
];
//...2.2) Update solr core name in .env file
If it is an existing setup, don't forget to update solr core to the new v2 core you created.
2.3) Enable NativeLiveSearch es6 module in assets/main/js/es6/config.js
javascript
//...
import NativeLiveSearch from './components/native-live-search';
//...
export default {
//...
modules: {
//...
// Enable this module if searchPartsEnabled solr version is v2
NativeLiveSearch: {
module: NativeLiveSearch
}
//...
},
//...
};2.4) Switch live_search view component from template system to live_search_v2
Inside application/config/mainTemplate.json (assuming client uses main template) inside components object, replace liveSearch.view from live_search to live_search_v2.
json
{
"components": {
"liveSearch": {
"view": "live_search_v2"
}
}
}If the client uses different key for the liveSearch component, replace that key's view value instead.
2.5) Compile assets
After making the above changes, make sure to run npm ci && npm run production to compile the assets since there are changes in the es6 modules and stylesheets.
3) Tweaking NativeLiveSearch
It is advised to not directly modify the native-live-search module. All parameterizable values are exposed to the es6 module loader. Should you need to modify any of the values, you can do so by updating configuration in assets/main/js/es6/config.js.
javascript
//...
export default {
//...
modules: {
//...
NativeLiveSearch: {
module: NativeLiveSearch,
moduleOpts: {
debounceTime: 300, // We changed default 100 debounce timer to 300
}
}
//...
},
//...
};//...