Does DefaultRenderer=HTTP work with multiple domain names?

Jul 9, 2013 at 6:23 PM
Hello,
Thank you for this lovely package.

I have a question about the "FullTextSearch.config" option for <DefaultRenderer>. According to your documentation, it seems that to use the recommended value of "HTTP", the website's domain name needs to be specified in <HttpHost>. I was wondering how/if this would work for a website with multiple possible domain names (assigned via the "umbraco hostnames" functionality). For instance, development and production domains, or in multi-site environments, separate domain names specified for each rootnode.

In one of these cases, what should the value of <HttpHost> be?

Thanks,
Heather
Coordinator
Jul 10, 2013 at 11:47 AM
Hi Heather

Setting the "HTTP" value, will construct a URL for each node id and use WebRequest to get the html response rendered for each URL. This html is then used to index that node's content. This URL is making use of the umbpageid querystring set to the value of the current node id. Irrespective of the URL, as long as umbpageid is set, Umbraco will return that node rendered in its template. It seems this is also the case across multiple Umbraco hostnames.

For example, if you have the following content structure:

Content
--domain1.com (root node with hostname)
---page1 (id = 1)
--domain2.com (root node with hostname)
---page2

Then the following URLs will all return the same html (for page1):
domain1.com/default.aspx?umbpageid=1
domain2.com/default.aspx?umbpageid=1

This is because umbpageid is set to 1 which will render node with id 1 (irrespective of the rest of the URL).

FullTextSearch is using "HttpUrl" and "HttpHost" to construct this URL used by WebRequest for each node id. For example, if only "HttpUrl" is specified as follows: domain1.com/default.aspx - then these URLs will have the following format: domain1.com/default.aspx?umbpageid=x. If you also specify "HttpHost", then this host name will be assigned to the WebRequest's "Host" value.

However because the URL is using umbpageid, the host name and URL path doesn't really matter, since umbpageid will return the html of id anyway.

So the answer should be: as long as the "HttpHost" value entered matches one of your Umbraco hostnames (i.e. the URL with your host and the umbpageid query string actually exists), it should index all pages and not only those for the specified hostname in "HttpHost". You also don't need to specify each host name. If you're using "HttpHost", just ensure it matches one of you host names. If you're not using "HttpHost", ensure your "HttpUrl"'s host matches one of your host names.

Lastly, do not confuse this with searching subsets of your site only, for example having a multi-lingual site (each in its own root folder with hostname) and wanting to implement a separate search for each where it would only index content for that language. Currently FullTextSearch indexes the entire content structure. However it should be possible to add additional functionality to limit the search results to subdomains/parent nodes only.

I hope this helps.

Regards,
Rigardt
Governor Technology
Jul 11, 2013 at 2:36 PM
Thanks, Rigardt, for the detailed explanation. I'm sure my ignorance about the inner-workings of Examine/Lucene is becoming obvious to you :-).

What is interesting is that I am working on a "local" copy of the website files (for easier VS debugging, etc), but access the same umbraco db as my main "dev" server environment, and sync the files between my local and dev environment daily.

I have both the ".local" and "dev" domains specified via umbraco Hostnames.

I used the "dev" domain name in the FullTextSearch.config file, and when viewing the site on my ".local" domain, it seems that only the nodenames have been indexed, and I don't get summary information below the results, but when I view the site on the dev environment's domain, matching the domain used in the config file, the results include the summaries, etc.

If I change the domain name in the config file to the ".local" domain and reindex on my .local environment, I can then see the full results on the .local site. I suppose this means I will need to remember to update the domain name when I move the files to a production environment on yet another domain. :-)

Also, point taken about the multi-lingual/"per-site" searching. I imagine that there could be a way to just limit the displayed search results to include only pages underneath a certain "ancestor" root node...
Coordinator
Jul 11, 2013 at 4:57 PM
Hi Heather

At first thoughts, I would've expected it to still find the summary text for each result, even if your searching on your local domain but with the config pointing to your dev domain. What this would mean is for each node id indexed locally, it would construct a dev url with the umbpageid query string to get the rendered html for indexing for that local node which is also what is used for the summary text. FullTextSearch will not prevent you from doing this, however I would not recommend having the domain in the config different from the actual domain your on as it wasn't designed and tested to behave in this way.

There might also be other factors involved when syncing between two environments with a shared database for example the actual Lucene index files generated, the umbraco.config etc.

I know it introduces a second step to change the config domain as you switch between the domains but this would be the safer option if possible. Like you said, you'll have to do this when going live as well.

We can always look into adding a few enhancements which can automate this process more in the future.

Let me know if you have any other issues regarding this topic.

Best regards,
Rigardt
Governor Technology
Jul 17, 2013 at 7:19 PM
Hi Rigardt,

I wonder if it might be possible to have the option of using a web.config value:
<add key="FullTextSearchHttpHost" value="mysite.com"/>
to override the "<HttpHost>" value in the FullTextSearch.config, if provided.

Since environment-level values are often changed in the web.config (sql connection string, smtp info, etc), it would make sense to allow it to be specified there.

Heather
Coordinator
Jul 22, 2013 at 8:18 AM
Hi Heather

Yes, that would make sense. Thanks for the suggestion - I'll add it in and upload a new version shortly.

Regards,
Rigardt
Coordinator
Jul 23, 2013 at 4:01 PM
Hi Heather

We've released a new version with the requested functionality. You can now add either or of the following web.config app settings which will override those in FullTextSearch.config:

1) FullTextSearchHttpUrl
2) FullTextSearchHttpHost

Please refer to you appropriate version of FullTextSearch from the following: 4.7.1 / 4.8.1 / 6.0.1

Best regards,
Rigardt
Governor Technology
Jul 23, 2013 at 7:33 PM
Edited Jul 23, 2013 at 7:34 PM
Awesome! Thanks for this :-)

A question about updating... Did you only change the .dll file? perhaps I could just "patch" rather than re-install the package, by renaming the included file from "7fe6c7fe-2b08-4872-90ef-24272abc56a8.dll" to "Governor.Umbraco.FullTextSearch.dll" and adding to the bin folder?
Coordinator
Jul 24, 2013 at 8:26 AM
Hi Heather

Yes, you should be able to just drop in the new DLL as suggested. Please make sure to backup the original one first. This release also contains a small update in the FullTextSearch.cshtml which I will indicate in the other related issue if you wanted to apply this manually as well.

Regards,
Rigardt
Jul 24, 2013 at 5:15 PM
Thanks, I was able to complete the manual update as well.