Gravatar for

Question by slokre, May 8, 2015 7:02 PM

advanced setting for enableSearchAsYouType

We are using enableSearchAsYouType with query box. I want to explore the possibility of having some advanced attribute with this setting, e.g.

  • Ability to define number of characters before search begins
  • Define Relevancy threshold minimum for suggested content returned in type-ahead
  • Ability to define specific keywords and apply unique weighting factors(i.e overview boost +10)
  • Ability to define specific content to be boosted(i.e “Salesforce for outlook installation guide “ boost +30)

Can anyone please suggest me ways to achieve this?

1 Reply
Gravatar for

Answer by Martin Laporte, May 11, 2015 3:36 AM

There is presently no option for specifying the number of characters before search as you type fires a query, but you can configure the delay before a search is trigger with the searchAsYouTypeDelay option.

Also, it's not possible to explicitly filter on relevancy (by definition any result returned needs to "match" the query), but you could use the preprocessResults event to prune out results with a lower score before the framework processes them. But be aware that the score value on a result is not an absolute number.

For your two last questions, you should use Ranking Expressions in the advanced query (inject them in the buildingQuery event). For example this expression boosts the keyword overview by a score of 10:

$qre(expression: overview, modifier: 10)

Gravatar for

Comment by slokre, May 12, 2015 12:39 PM

Thanks Martin,

Will this also affect final search result or only the 'search as you type' (suggested) result. I was also looking for something that admins can do in adhoc way from the console.


Gravatar for

Comment by Martin Laporte, May 18, 2015 8:27 AM

It really depends on how you grab suggestions. The ones from search analytics data won't be affected for sure. If you're using TopFieldSuggestions you'd need to include the same $qre(...) expression inside the data-query-override option.

Ask a question