Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
gabineaq
Partner - Contributor III
Partner - Contributor III

Mashup custom search problem (selectAssociations limit)

Hello everyone,

I've built a mashup with a custom search function using Capability API. I'm using the searchResults and selectAssociations methods. My mashup works perfectly fine with 8 - 10 search items.

However, when I select 11 or more items, for example 11 stores (store 1, store 2, ...., store 11), the selection doesn't work. The error that I receive in Chrome dev console is this:
code: 15000, parameter: "Search query took to long", message: "Search timeout".

It seems that selectAssociations has a search limit.

Is there something I can do to optimize the response time or to bypass the limit, if the limit exists?

Labels (1)
  • API

1 Solution

Accepted Solutions
Aiham_Azmeh
Employee
Employee

Hi @gabineaq,

This is a known issue, the smart search team have been contacted and will deal with by either documenting a limitation or fix it.

A possible workaround will be to split the array of search terms in 2 or more arrays then chain the selectAssociations calls

const searchTermsPart1 = ['store1','store2','store3','store4'];
const searchTermsPart2 = ['store5','store6','store7','store8'];
app.selectAssociations( 0, searchTermsPart1 ).then(()=>{
  app.selectAssociations( 0, searchTermsPart2 );
});
// nicer if used with async await

I hope this helps,

 

 

View solution in original post

2 Replies
Aiham_Azmeh
Employee
Employee

Hi @gabineaq,

This is a known issue, the smart search team have been contacted and will deal with by either documenting a limitation or fix it.

A possible workaround will be to split the array of search terms in 2 or more arrays then chain the selectAssociations calls

const searchTermsPart1 = ['store1','store2','store3','store4'];
const searchTermsPart2 = ['store5','store6','store7','store8'];
app.selectAssociations( 0, searchTermsPart1 ).then(()=>{
  app.selectAssociations( 0, searchTermsPart2 );
});
// nicer if used with async await

I hope this helps,

 

 

gabineaq
Partner - Contributor III
Partner - Contributor III
Author

Hi @Aiham_Azmeh,

Thanks for the reply. It's really useful.

I'll try to chain the selectAssociations calls and check how the search performs.