Gravatar for

Question by emil_christiansen, Jul 5, 2016 6:36 AM

Extracting the searchterm typed in by the user

Hi again!

Related to this question:

I am having trouble extracting the searchterm typed in by the user.

When debugging -[0] doesn't seem to do the trick.

Any suggestions?


[EDIT] Converted to a new question to keep questions and answers organized.

1 Reply
Gravatar for

Answer by Jean-François L'Heureux, Jul 5, 2016 1:19 PM


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 queryBuilder.expression.

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,


Ask a question