Excluding specific field value from search I want to find all entries that match the title field where excludeFromSearch != 1 (is false).

{% set query = 'and excludeFromSearch not 1 and ' ~ 'title:"' ~ "myValue" ~ '"' %}

    {% set results = craft.entries({
    section: querySections,
    search: query,
    orderBy: 'score',
    }).limit(50) %}


It does not work. My field excludeFromSearch is a lightswitch.
The light switch value should be taken out of the search query and put into the entry query:

{% set query = 'title:"' ~ "myValue" ~ '"' %}
{% set results = craft.entries({
    section: querySections,
    search: query,
    excludeFromSearch: 'not 1',
    orderBy: 'score',
    }).limit(50) %}


Or slightly cleaner / Craft 3:

{% set query = 'title:"' ~ "myValue" ~ '"' %}
{% set entryQuery = craft.entries
    .section(querySections)
    .search(query)
    .excludeFromSearch('not 1')
    .orderBy('score')
    .limit(50)
%}

{% set entries = entryQuery.all() %}