: documentation that I can limit results to category "A" as follows: : : fq={!raw f=foo}A : : But I cannot seem to (Solr 3.6.1) exclude that way: : : fq={!raw f=foo}-A
with the raw" qparser, there is no markup syntax at all -- so it's interpreting the "-" as part of the literal term value you are trying to query for. : And the simpler test (with edismax) doesn't work either: : : fq=foo:A # works : fq=foo:-A # doesn't work likewise: in the lucene/dismax/edismax parsers operatores (like "-" and "+") need to come before the field you are querying on... fq=-foo:A or fq={!edismax}-foo:A If you upgrade to a more current 4.x version of Solr, then the default (lucene) parser in solr has been updated to recognize nested parser syntax (ie: "{!parser}input") as inline clauses, so you can use something like this... fq=-{!raw f=foo}A ...which results in the (default) lucene parser recognizing the "-" operator should be applied to a nested clause which is generated by asking the "raw" parser to use the local param "f=foo" when parsing the input "A" One thing to watch out for however is whitespace -- if you have a query like this... fq=-{!raw f=foo}AAA BBB ...then the (default) lucene parser gets 2 clauses: a negated clause resulting form asking the "raw" parser to parse "AAA" and a positive clause that hte lucene parser parses itself, using the default search field to look for "BBB". You would nee to use the "v" local param to ensure that the entire string gets parsed by the raw parser, either... fq=-{!raw f=foo v='AAA BBB'} or fq=-{!raw f=foo v=$my_foo_fq}&my_foo_fq=AAA BBB -Hoss