Extracting the searchterm typed in by the user
Related to this question: https://answers.coveo.com/questions/6754/coveo-for-sitecore-omnibox-result-list-only-search-in-one-specific-field
I am having trouble extracting the searchterm typed in by the user.
When debugging - args.queryBuilder.expression.parts doesn't seem to do the trick.
[EDIT] Converted to a new question to keep questions and answers organized.
I guess you run your code in an event handler for the "buildingQuery" event. When your event handler is called, you can not guarantee that the search box ran its own "buildingQuery" event handler code where it sets the
You could modify your code to hook to the "doneBuildingQuery" event instead of "buildingQuery". There, you will be sure the other components of the page will have set their expressions in the expression, advancedExpression and constantExpression.
I hope this helps,