Closed (fixed)
Project:
Rules
Version:
7.x-2.3
Component:
Rules Core
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
10 May 2013 at 12:16 UTC
Updated:
11 Sep 2014 at 10:03 UTC
Jump to comment: Most recent
Comments
Comment #1
russelljtdyer commentedI have the same problem. Are there no ideas to solve this? Is the problem with the Search module or the Rules module? What do y'all think?
Perhaps someone could suggest a condition that would exclude the Search module from my rule. I tried altering my rule to include a condition regarding the URL, thinking I could say that if it started with the path,
/searchthat is should not apply. But that didn't work. Maybe I just don't know how to configure the rule, properly. I'd appreciate any suggestions on what I might try there.Thanks in advance.
-Russell
Comment #2
russelljtdyer commentedI may have figured out the solution--at least the solution for my situation. After the search is performed, the Search module takes the user to the path
/search/node/[search term], where the [search term] is the term entered by the user. If the search term is one for which there is a URL alias, it will redirect the user to that page, or at least as best it can. If there's not a URL alias for the term, the search page is displayed with the results. So the problem seems to be only with the search results page, not the searching.Based on the above, I added a condition to my rule to solve the problem. I suggested this in my previous post, but this time I got it right. First I added a
ANDoperator. Then I added the condition, Path has URL alias. For the Existing parameter path, I entered the value,/search/node. I also checked the Negate box for the condition. The result is that the search results page is not redirected and it works fine now.UPDATE: I was wrong. That didn't work. I was just clobbering the rule so that it didn't work under any circumstance. But think I'm on the right path. I just need to figure out how to identify properly the path.
Comment #3
russelljtdyer commentedI think I've finally found a way around this problem. It requires the Context module (which I am already using), and the Context Rules module. The Context Rules module will integrate the Context module with the Rules module.
First I created a context and called it search-node--the name doesn't matter, though. I added to the Conditions section of the context, a condition based on Path. I entered a path of
search/node/*. I gave no Reactions for the context. I don't want it to do anything other than determine the path matched. I then saved and went to the Rules configuration page (/admin/config/workflow/rules).For my rule, I added an
ANDoperator to the end of the conditions for the rule. Then I added a condition under the Context Rules section from the pull-down menu. I selected, Is a context set. That gave me another menu to select which context I want to set as a condition of the rule. I selected the one I just created, search-node. Then I checked the box for Negate and clicked Save.I've tested pretty extensively this combination and it seems to hold up well. Hopefully, I'm finished with this problem and this thread and it is useful to others.
Comment #4
farse commented#3 works a treat, thanks!
Comment #5
farse commentedComment #7
Abhinesh Sharma commentedGreat work @russelljtdyer
Comment #8
reinis.berzins commentedI managed to solve it without Context and Context Rules module. Just added a new condition "Check a truth value" to the basic Rules module and in "Truth Value" field wrote:
<? return strpos($_SERVER['REQUEST_URI'], "search/node") == false; ?>to prevent executing redirection rule while on Search Results (search/node) page.