When I perform a search with the following Solr query I get what I want: "courses" that have been tagged with the terms 'PHP' or 'Programming'.
q=[* TO *]&facet=on&facet.field=facet_contenttype&fq=facet_contenttype:mediaitems_course&facet.field=facet_wmterm&fq=(facet_wmterm:PHP OR Programming)
Now, I want to also include courses that have been tagged with 'C# .NET'. The entire string 'C# .NET' is one tag in the CMS I am using. I have tried the following possibilities for the facet_wmterm filter query.
&fq=(facet_wmterm:PHP OR Programming OR C# .NET) // no quotes
&fq=(facet_wmterm:PHP OR Programming OR 'C# .NET') // quotes
&fq=(facet_wmterm:PHP OR Programming OR 'C#+.NET') // quotes and replaced space for + sign
&fq=(facet_wmterm:PHP OR Programming OR C#%2b.NET) // no quotes, encoded + sign
&fq=(facet_wmterm:PHP OR Programming OR 'C#%2b.NET') // quotes, encoded + sign
&fq=(facet_wmterm:PHP OR Programming OR 'C%23+.NET') // quotes, encoded # sign
&fq=(facet_wmterm:PHP OR Programming OR C%23+.NET) // no quotes, encoded # sign
&fq=(facet_wmterm:PHP OR Programming OR 'C%23%2B.NET') // quotes, encoded # and + signs
&fq=(facet_wmterm:PHP OR Programming OR C%23%2B.NET) // no quotes, encoded # and + signs
and a lot more options....
Strangely, all the above options return ALL courses, no matter what they are tagged with and I am pretty sure I am not looking at caching, because removing the 'C# .NET' bit gives me the initial, correct 'PHP or Programming' results.
I'd LOVE to learn how to include 'C# .NET' in my facet query, because I am about to go slightly mad :) Thanks!
Repeating the field name does have an effect.
&fq=facet_wmterm:Test1 OR PHP
..is giving me ALL results (= wrong) and repeating the field name like this
&fq=facet_wmterm:Test1 OR facet_wmterm:PHP
..is giving me courses with Test1 or PHP only (= correct!). Thanks for that Ansari.
This still didn't help me to properly query for .NET C# courses though, because I was also incorrectly escaping special characters. In Solr you can use quotes to search literally for what is between the quotes, but you have to use double quotes instead of the single quotes I was using. http://wiki.apache.org/solr/SolrQuerySyntax
This worked for me:
&fq=(facet_wmterm:Test1 OR "C# .NET")