I recently created a subdomain for my site. Is there a way to have that subdomain use the full text search, and only that subdomain. I don't want the pages to show up on the main domain.
Depending a little bit on the way your subdomain is structured in your Umbraco Tree (is it within the main site, or at the same level ?). You could create a separate index for the subdomain, and on this specific index use the option to set the IndexParentId which causes only content beneath the page with this id to be indexed, eg
Every document in Umbraco has a Path property, which is a comma delimited string of the ids of the documents above the document in the tree eg
-1, 1234, 2533, 56333
would be the path to the document with Id 56333, it's parent id is 2533 etc etc up to -1 (the root of the site)
This path is available in examine, so you could still have one index for your sites, but when querying the index filter on the path of your subdomain.
It follows that if your subdomain has an id of 1234 then all pages within the subdomain would have a path beginning -1, 1234 ...
The only slight problem with this is the comma delimited messes up the lucene syntax to do the query, but there is a workaround with adding a custom 'SearchPath' entry to the index with the commas removed.
There is quite an old blog post by AttackMonkey here, which explains the concept well:
Site search on subdomain?
I recently created a subdomain for my site. Is there a way to have that subdomain use the full text search, and only that subdomain. I don't want the pages to show up on the main domain.
Thanks.
Hi Tom
Depending a little bit on the way your subdomain is structured in your Umbraco Tree (is it within the main site, or at the same level ?). You could create a separate index for the subdomain, and on this specific index use the option to set the IndexParentId which causes only content beneath the page with this id to be indexed, eg
or alternatively
Every document in Umbraco has a Path property, which is a comma delimited string of the ids of the documents above the document in the tree eg
-1, 1234, 2533, 56333
would be the path to the document with Id 56333, it's parent id is 2533 etc etc up to -1 (the root of the site)
This path is available in examine, so you could still have one index for your sites, but when querying the index filter on the path of your subdomain.
It follows that if your subdomain has an id of 1234 then all pages within the subdomain would have a path beginning -1, 1234 ...
The only slight problem with this is the comma delimited messes up the lucene syntax to do the query, but there is a workaround with adding a custom 'SearchPath' entry to the index with the commas removed.
There is quite an old blog post by AttackMonkey here, which explains the concept well:
http://www.attackmonkey.co.uk/blog/2011/12/limiting-an-examine-search-to-the-current-site
the indexing part of this article is still relevant but the way events are wired up has changed in the latest version of Umbraco:
https://our.umbraco.org/Documentation/Reference/Events/Application-Startup
Hope that makes sense!
regards
Marc
is working on a reply...