I created a view using indexed fields (search api) to list a taxonomy. I used the rest export checkbox so I have an api endpoint for my view. I am not able to find a filter criteria "starts with" for a field (indexed) that is a string. I don't understand why, the field is behaving like an integer and showing greater than, less than etc..

I am trying to use the hook_views_query_alter but I am getting an error from the line $query->where :

Error: Cannot access protected property Drupal\search_api\Plugin\views\query\SearchApiQuery::$where

In my view , I can see in the "Preview" section the query :

Index: books
Keys: NULL
Options: array (
    'search_api_view' => 'object (Drupal\\views\\ViewExecutable)',
    'search_api_base_path' => 'api/books',

How do I add a filter criteria "starts with" for an indexed field which is a string? Thanks for your help


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.