Итак, у меня есть база данных, проиндексированная в solr, и я пытаюсь отфильтровать предложения поиска (рекомендательный пример) с помощью ContextField/cfq. То, что я пытаюсь сделать, это отфильтровать запросы предложения к тем элементам, у которых поле контекста (логическое поле) установлено равным false, или которые не имеют поля. Использование только ложных не работает, я не уверен как сформулировать его внутри поля suggest.cfq внутри файла solrconfig.xml, так как поле уже объявлено как контекстное поле, и похоже, что я не могу (-myfield: [* TO *] AND :) ИЛИ myfield :ложный. Как делать то, что я хочу делать?Предложения Solr с ContextField: не все объекты имеют это поле
Соответствующий кусок solrconfig.xml:
<searchComponent name="suggest" class="solr.SuggestComponent">
<lst name="suggester">
<str name="name">composerSuggest</str>
<str name="lookupImpl">AnalyzingInfixLookupFactory</str>
<str name="indexPath">suggestions/composerSuggest_dict</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">composers_searchable</str>
<str name="weightField">price</str>
<str name="suggestAnalyzerFieldType">suggestTypeLc</str>
<str name="buildOnStartup">true</str>
<str name="buildOnCommit">false</str>
<str name="highlight">false</str>
</lst>
<lst name="suggester">
<str name="name">pieceSuggest</str>
<str name="lookupImpl">AnalyzingInfixLookupFactory</str>
<str name="indexPath">suggestions/pieceSuggest_dict</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">pieces_searchable</str>
<str name="weightField">price</str>
<str name="contextField">hidden</str>
<str name="suggestAnalyzerFieldType">suggestTypeLc</str>
<str name="buildOnStartup">true</str>
<str name="buildOnCommit">false</str>
<str name="highlight">false</str>
</lst>
<lst name="suggester">
<str name="name">collectionSuggest</str>
<str name="lookupImpl">AnalyzingInfixLookupFactory</str>
<str name="indexPath">suggestions/collectionSuggest_dict</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">collections_searchable</str>
<str name="weightField">price</str>
<str name="suggestAnalyzerFieldType">suggestTypeLc</str>
<str name="buildOnStartup">true</str>
<str name="buildOnCommit">false</str>
<str name="highlight">false</str>
</lst>
<lst name="suggester">
<str name="name">languageSuggest</str>
<str name="lookupImpl">AnalyzingInfixLookupFactory</str>
<str name="indexPath">suggestions/languageSuggest_dict</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">languages_searchable</str>
<str name="weightField">price</str>
<str name="suggestAnalyzerFieldType">suggestTypeLc</str>
<str name="buildOnStartup">true</str>
<str name="buildOnCommit">false</str>
<str name="highlight">false</str>
</lst>
<lst name="suggester">
<str name="name">genreSuggest</str>
<str name="lookupImpl">AnalyzingInfixLookupFactory</str>
<str name="indexPath">suggestions/genreSuggest_dict</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">genres_searchable</str>
<str name="weightField">price</str>
<str name="suggestAnalyzerFieldType">suggestTypeLc</str>
<str name="buildOnStartup">true</str>
<str name="buildOnCommit">false</str>
<str name="highlight">false</str>
</lst>
<lst name="suggester">
<str name="name">locationSuggest</str>
<str name="lookupImpl">AnalyzingInfixLookupFactory</str>
<str name="indexPath">suggestions/locationSuggest_dict</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">locations_searchable</str>
<str name="weightField">price</str>
<str name="suggestAnalyzerFieldType">suggestTypeLc</str>
<str name="buildOnStartup">true</str>
<str name="buildOnCommit">false</str>
<str name="highlight">false</str>
</lst>
<lst name="suggester">
<str name="name">sourceSuggest</str>
<str name="lookupImpl">AnalyzingInfixLookupFactory</str>
<str name="indexPath">suggestions/sourceSuggest_dict</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">sources_searchable</str>
<str name="weightField">price</str>
<str name="suggestAnalyzerFieldType">suggestTypeLc</str>
<str name="buildOnStartup">true</str>
<str name="buildOnCommit">false</str>
<str name="highlight">false</str>
</lst>
<lst name="suggester">
<str name="name">instrumentSuggest</str>
<str name="lookupImpl">AnalyzingInfixLookupFactory</str>
<str name="indexPath">suggestions/instrumentSuggest_dict</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">instruments_voices_searchable</str>
<str name="weightField">price</str>
<str name="suggestAnalyzerFieldType">suggestTypeLc</str>
<str name="buildOnStartup">true</str>
<str name="buildOnCommit">false</str>
<str name="highlight">false</str>
</lst>
<lst name="suggester">
<str name="name">tagSuggest</str>
<str name="lookupImpl">AnalyzingInfixLookupFactory</str>
<str name="indexPath">suggestions/tagSuggest_dict</str>
<str name="dictionaryImpl">DocumentDictionaryFactory</str>
<str name="field">tags_searchable</str>
<str name="weightField">price</str>
<str name="suggestAnalyzerFieldType">suggestTypeLc</str>
<str name="buildOnStartup">true</str>
<str name="buildOnCommit">false</str>
<str name="highlight">false</str>
</lst>
</searchComponent>
<requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy" >
<lst name="defaults">
<str name="suggest">true</str>
<str name="suggest.count">15</str>
<str name="suggest.cfq">(-hidden:[* TO *] AND *:*) OR hidden:false</str>
</lst>
<arr name="components">
<str>suggest</str>
</arr>