#1906 fixed search multi keys (ajax query params miswrited qs.stringify arrayFormat)
This commit is contained in:
parent
40b7e75d44
commit
1565ce8aa2
|
@ -44,7 +44,18 @@ class Base extends ControllerBase {
|
||||||
'nids' => []
|
'nids' => []
|
||||||
];
|
];
|
||||||
|
|
||||||
// PHRASE QUERY
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ,---.| ,---.
|
||||||
|
// |---'|---.,---.,---.,---.,---. | |. .,---.,---., .
|
||||||
|
// | | || ,---|`---.|---' | || ||---'| | |
|
||||||
|
// ` ` '` `---^`---'`---' `---\`---'`---'` `---|
|
||||||
|
// `---'
|
||||||
// (to match exact materials names (like "wood-skin"))
|
// (to match exact materials names (like "wood-skin"))
|
||||||
$this->phrase_query = $this->index->query(['offset'=>0,'limit'=>10000]);
|
$this->phrase_query = $this->index->query(['offset'=>0,'limit'=>10000]);
|
||||||
// set parse mode and conjunction
|
// set parse mode and conjunction
|
||||||
|
@ -82,7 +93,12 @@ class Base extends ControllerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// AND QUERY
|
|
||||||
|
// ,---. | ,---.
|
||||||
|
// |---|,---.,---| | |. .,---.,---., .
|
||||||
|
// | || || | | || ||---'| | |
|
||||||
|
// ` '` '`---' `---\`---'`---'` `---|
|
||||||
|
// `---'
|
||||||
$this->and_query = $this->index->query(['offset'=>0,'limit'=>10000]);
|
$this->and_query = $this->index->query(['offset'=>0,'limit'=>10000]);
|
||||||
// set parse mode and conjunction
|
// set parse mode and conjunction
|
||||||
$parse_mode = \Drupal::service('plugin.manager.search_api.parse_mode')
|
$parse_mode = \Drupal::service('plugin.manager.search_api.parse_mode')
|
||||||
|
@ -191,9 +207,12 @@ class Base extends ControllerBase {
|
||||||
$this->exactematch_count = count($this->results['nids']);
|
$this->exactematch_count = count($this->results['nids']);
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// OR QUERY
|
// ,---. ,---.
|
||||||
//
|
// | |,---. | |. .,---.,---., .
|
||||||
|
// | || | || ||---'| | |
|
||||||
|
// `---'` `---\`---'`---'` `---|
|
||||||
|
// `---'
|
||||||
$this->or_query = $this->index->query(['offset'=>0,'limit'=>10000]);
|
$this->or_query = $this->index->query(['offset'=>0,'limit'=>10000]);
|
||||||
|
|
||||||
// Change the parse mode for the search.
|
// Change the parse mode for the search.
|
||||||
|
|
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -135,7 +135,7 @@ export default {
|
||||||
},
|
},
|
||||||
getResults ({ dispatch, commit, state }) {
|
getResults ({ dispatch, commit, state }) {
|
||||||
const params = {
|
const params = {
|
||||||
keys: state.keys,
|
keys: state.keys.join(', '),
|
||||||
terms: JSON.stringify(state.terms),
|
terms: JSON.stringify(state.terms),
|
||||||
offset: state.offset,
|
offset: state.offset,
|
||||||
limit: state.limit
|
limit: state.limit
|
||||||
|
@ -147,6 +147,9 @@ export default {
|
||||||
}
|
}
|
||||||
// console.log('Search getResults params', params)
|
// console.log('Search getResults params', params)
|
||||||
const q = qs.stringify(params)
|
const q = qs.stringify(params)
|
||||||
|
// * Qs.Stringify () Arrayformat: 'Repeat' : https://programmerall.com/article/31901061156/
|
||||||
|
// const q = qs.stringify(params, { arrayFormat: 'comma', encode: false })
|
||||||
|
// * arrayFormat is not working, made state.keys.join(', ') instead
|
||||||
return MA.get('/materio_sapi/getresults?' + q)
|
return MA.get('/materio_sapi/getresults?' + q)
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
console.log('search MA getresults data', data, state.terms)
|
console.log('search MA getresults data', data, state.terms)
|
||||||
|
|
Loading…
Reference in New Issue