Reputation: 1478
Trying to find solution to build query so I can filter certain docs like so:
if category = xyz
-created:[* TO NOW-7DAY/DAY]
else
no filtering
Is that generally possible or will I need to do this after receiving the results? And if possible, of course, how?
Upvotes: 0
Views: 895
Reputation: 9789
You are looking for Switch parser from recent Solr. I also published an example that's used in multi-field advanced search. Notice that you can switch on specific value, presence of (any) value and missing value.
Upvotes: 1
Reputation: 52792
You can query for either the correct category and the time sequence you want, or documents with another category than the one required for the first match.
(category:xyz AND -created[* TO NOW-7DAY/DAY]) OR -category:xyz
Upvotes: 2