How can I programmatically change the parse mode? We have a view that works with Search API and Solr search. The multiple search terms work with single quotes and with no quotes. I want to make the search terms work with double quotes as well. The issue is also listed here without a fix:
https://www.drupal.org/project/search_api/issues/2141575
I found that I can change the parse mode in the View &gt; Query &gt; Settings to direct method and the term with double quotes work just fine. I want to make this change using hooks. I have tried hook_search_api_views_query_alter and it does not work. Does anyone know how to change the parse mode in the query settings using hooks?
On Drupal 7, I've achieved this by using hook_views_pre_build() since this hook is executed before hook_views_pre_execute() and hook_search_api_views_query_alter(). Using code similar to the following will do the job.
$options = $view-&gt;display_handler-&gt;get_option('query');
$options['options']['parse_mode'] = 'TYPE_OF_PARSE_MODE';
$view-&gt;display_handler-&gt;set_option('query', $options);

Note that TYPE_OF_PARSE_MODE can be:

Direct query - direct
Single term - single
Multiple terms - terms