Krystian
Krystian

Reputation: 1026

Drupal 7 - exposed filter - full text search

I'm using Drupal 7 with Views 3. I created an exposed filter for text field. In exposed filter options from Operator dropdown I selected Contains, so query goes like this:

SELECT ... WHERE some_field LIKE...

Is it possible to change it simply (plugin/module/some options/etc) to mysql fulltext search?

Any tip would be appreciated:)

Upvotes: 2

Views: 2145

Answers (1)

Krystian
Krystian

Reputation: 1026

OK, I have manage it:)

In views_query_alter hook in my view I switch the condition like this:

unset($query->where[1]['conditions'][0]);
$query->add_where_expression('AND', MATCH(field_data_field_searchable.field_searchable_value) AGAINST ('{$searchable_value}' IN BOOLEAN MODE)");

Upvotes: 1

Related Questions