Whitelist AOD Search terms?

Is there a way to whitelist AOD search terms, or eliminate terms from the submitted query?

For example, the user enters “The Paper Store”, which gets translated as the+paper+store in the query. But my webserver will time out while Lucene looks for the individual terms - and “the” could be a rather large problem.

Not out of the box, but I think this is a good suggestion for future implementations!

Thanks,

Will.

Hi Klou,

As Will said there isn’t anything in place at the moment but you could add a workaround to

custom/modules/Home/UnifiedSearch.php

.

You can alter the $queryString variable around line 26. Removing terms could look something like this (untested!):

$queryString = ! empty($_REQUEST['query_string']) ? $_REQUEST['query_string'] : '';
$tmp = explode(' ',$queryString);
$blacklistedTerms = array('the','a','an');
$tmp = array_diff($tmp, $blacklistedTerms);
$queryString = implode(' ',$queryString);

It’s worth noting that this file may be updated by future SuiteCRM upgrades so you may lose these changes in the future.

Hope this helps,
Jim

There seems to be something wrong with parsing the search terms. According to : https://lucene.apache.org/core/2_9_4/queryparsersyntax.html a double quoted string should look for the phrase and not the individual words. It seems the quotes might be stripped from the query resulting in a search for all of the individual words.

FIXED
in custom/modules/Home/UnifiedSearch.php decode the html entities after the parameter has been retrieved from the REQUEST

$queryString = html_entity_decode($queryString);

This decodes " in the search string back to double quotes. So now phrases are found correclty.

1 Like