Closed (fixed)
Project:
Domain
Version:
5.x-1.0beta6
Component:
- Domain Content
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 Nov 2007 at 16:04 UTC
Updated:
9 Dec 2007 at 21:11 UTC
this is a great module!
I'm looking for a way for searching the content of the site[s], like multi-search. If a node was assigned to subdomain.domain.name, i cannot search it through the root domain or other sub domains.
your input is appreciated
thanks
Comments
Comment #1
agentrickardThis behavior is part of how node_access works, and I haven't taken the time to explore deeply.
Actually, I'm pleased that this behavior occurs, since I was afraid it wouldn't behave that way.
Some thoughts:
- Nodes assigned to 'all affiliates' -- technically, with the 'domain_site' grant set -- should show up on all domains when searching.
- I think that hook_search() and hook_form_alter() _might_ allow you to change the default node_access behavior. You would want to force all nodes to have the 'domain_site' grant. See http://api.drupal.org/api/function/hook_search/5.
- It may also be possible to force this behavior by using hook_nodeapi() and the internal hook_domaingrants to rewrite the node_access rules on-the-fly if a user is running a search.
- That said, the answer may need to be a custom implementation of hook_search. The product would be a Domain Search module.
Comment #2
agentrickardSo it occurs to me that there is a simple solution to half of this problem.
- Use hook_domaingrants to write grants to all domains when users perform a search.
This _should_ make all nodes visible on the search page.
However, if you clicked on the link, it might take you to a page that is not accessible. For example:
- Node 1 is assigned to Domain A (exampleA.com)
- Node 2 is assigned to Domain B (exampleB.com)
- You search from Domain A (exampleA.com)
- Both nodes appear as search results
- Click on Node 1 -- OK, because the link goes to exampleA/node/1
- Click on Node 2 -- Access Denied, because the link goes to exampleA/node/2, but Node 2 belongs to exampleB.com
You would need to re-theme the search output so that the URLs were complete:
- Node 1 == exampleA.com/node/1
- Node 2 == exampleB.com/node/2
This can be done, but I think custom hook_search() is the answer.
Care to take a try at it?
Comment #3
derjochenmeyer commentedi have an aproach to that problem via configuration.
Scenario
subomain1: sub1.domain.com
subomain2: sub2.domain.com
subomain3: all.domain.com
Then:
I publish my content to the subdomain it belongs to.
In addition I publish my content always to all.domain.com.
Then you can create a searchpage with a dropdown that behaves like the Domain switcher block. ("search all", "seach sub1", "search sub2"). So you dont have to make the content available on all affiliate sites.
There are two things that would make life a lot easier:
1. If there was an option to automatically assign all content to an "all" sbdomain.
2. To auto-tag all content with a corresponding taxonomy term (Aso see this featre request: http://drupal.org/node/191099).
Thanks a lot for this great module!
Comment #4
agentrickardWell, request #1 is already in the module, I don't think you understood the concept of the 'root' domain correctly. The use-case is as follows:
- default domain: example.com -- all nodes are assigned to this by default (can be turned off)
- sub1 : one.example.com -- nodes are assigned here if created here
- sub2 : two.example.com
So I think your use of all.example.com is incorrect. That should be your "root" domain. For aesthetic reasons, you could have your server set to all.example.com as your root domain; that's up to you.
The documentation. From section 4.1 of README.txt:
See also:
By default, the 'New content settings' are set to TRUE, which sends all content to all affiliates -- defined as the root domain. For the technical side, read section 5 -- especially 5.3 and 5.4. It's the 'domain_site' grant that sends content to all affiliates.
You can also adjust this setting per _node type_, as described in 4.4.2.
If you want a different use-case, you can write a submodule to use hook_domaingrants and hook_domainrecords to add or modify permissions as you see fit.
Will address the other issue separately.
Comment #5
agentrickardThe issue of search links is actually very problematic.
Search is not the only module affected by this issue: MySite, Bookmarks, even perhaps Node Relativity could all be affected. The issue is that a node might be validly viewed on one domain, then added to a collection that can be viewed on another domain, but on the second domain, the node view is not valid.
Since Drupal doesn't set a URL in the $node object, there doesn't seem to be a universal way to handle this without hacking the url() function.
Comment #6
agentrickardPart of the fix has been committed to HEAD. Introduces the patch to provide hook_url_alter() which solves the absolute path issue.
Needs more testing.
Comment #7
agentrickardThis behavior is now controlled through a setting. Search can be across all affiliates or per affiliate at the admin's discretion.
Comment #8
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.