To add visitors to segments based on their search queries, define a “Search query” attribute. For more information, see Visitor journey attributes.