2

I decided to modify the View after all the content had been uploaded to the site. Now I am experiencing issues with the Filter Criteria, not picking up the nodes which I would expect to be picked up...

Here are the two different sets of Filter criteria I tried:

enter image description here

This View displays 2 search results.

enter image description here

The view above displays 3 results!

Now, what I was expecting is that the first set of filters would display the same number of results (at least) as the filter above. Because, the condition is OR. But that's not the case...

Is this normal behaviour?

I must not be reading the conditional statements correctly, because I am not displaying the results I am expecting...

2 Answers 2

0

You have 4 boolean variables here. Let's write some pseudo-code. They are $is_published $is_news $is_display_on_news $is_involved

First set of your rules is:

( $is_published and $is_news ) and ($is_display_on_news or $is_involved)

Second one looks like that:

( $is_published and $is_news ) and ($is_involved)

If we remove common part, first one reduces to

$is_display_on_news or $is_involved

and second one to

$is_involved

This means in second case you are ignoring nodes with $is_display_on_news set and $is_involved not set. Thus, first view should always return no less items than the second one.

If that's not the case, you need to enable "show query" in views GUI settings, and compare it on the SQL level. Maybe SQL conditions are rendered in invalid form? Impossible to say without actual SQL query.

Sometimes when you add new field to a content type, it ends not set for old nodes. It makes inner join exclude old nodes altogether. That way you can end up not seeing old nodes when you add OR condition - new join removes them from results before or condition is ever evaluated.

And sometimes it's just cache.

4
  • Thanks @Molot I ended up going into each node and resaving it, which then made them appear in the view they were supposed to be in. After introducing a new filter criteria, only the newly created pages were being picked up, not any of the previously created ones. HOwever, going into edit mode and saving, so to update, made everything ok.
    – kine456
    Commented May 20, 2013 at 6:11
  • If you just added new field, it ended up empty for old nodes. It made join fail. Either that, or caching problem. Both possible to see examining views on query level.
    – Mołot
    Commented May 20, 2013 at 6:13
  • Thanks! Must have been the failing join, because clearing the cache didn't seem to fix anything @molot
    – kine456
    Commented May 20, 2013 at 6:18
  • Added join issue to answer for future readers.
    – Mołot
    Commented May 20, 2013 at 6:18
0

I think you should change the 2nd AND statement to OR and last OR statement to AND. Looks like everything else is fine.

1
  • Thanks @heshanlk but that's not what I want :( I want the results to display if ONE or Both of the last two filters are true. They don't both have to be true, just one...
    – kine456
    Commented May 20, 2013 at 4:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.