XSLTSearch -restricted based on current hostname/site Options
timgaunt
Posted: Thursday, December 13, 2007 11:52:18 PM

Rank: Aficionado

Joined: 10/31/2007
Posts: 109
Location: Birmingham (UK)
I have the following set:
-domain1.com
-page 1
-page 2
-page 3
-domain2.com
-page 4
-page 5
-page 6

The issue I have is if I search on domain1.com I get results from domain2.com with the standard XSLTSearch.xslt. I've had a dig and can't see anyway of obviously restricting the topper node, I'm guessing I need to add something like this somewhere: $currentPage/ancestor-or-self::node [@level=1]

Any pointers?

Tim

Managing Director at The Site Doctor Ltd - My personal blog is here - Umbraco Newbie ;)
drobar
Posted: Friday, December 14, 2007 2:23:43 AM

Rank: Umbracoholic

Joined: 9/8/2006
Posts: 1,410
Location: KY, USA
Hi, Tim,

Unless you tell XSLTsearch otherwise, it searches all nodes of your site (that is, starting at the "-1" node).

XSLTsearch is highly configurable through the macro parameters. See the documentation for specifics and examples.

What you'd want to do is set the "source" parameter in the macro to the domain1 node (1046 in the code sample below... replace with the real node id). Then XSLTsearch will only look beneath that node.

Code:

<?UMBRACO_MACRO
    macroAlias="XSLTsearch"
    source="1046"
    searchFields="@nodeName,description,bodyText"
    previewFields="bodyText,description"
    previewType="beginning"
    searchBoxLocation="bottom"
    resultsPerPage="5"
    previewChars=”255”
    showPageRange="0"
    showOrdinals="0"
    showScores="0"
    showStats="0"
    >
</?UMBRACO_MACRO>



cheers,
doug.

MVP 2007-2009 - Official Umbraco Trainer for North America - Percipient Studios
AlHekal
Posted: Thursday, June 19, 2008 4:04:47 AM
Rank: Newbie

Joined: 6/19/2008
Posts: 2
Location: Hawaii
Hi, I've run into the same problem as we have 2 different domains(using Manage hostnames) under the root Content node.
If I specify a node for the source in domain1 than when I do a search in domain2 it gives the results of domain1(as I specified).
Is it possible(using timgaunt's example above) to specify only pages under and including domain1 or under and including domain2 depending which domain your at?
drobar
Posted: Thursday, June 19, 2008 1:34:42 PM

Rank: Umbracoholic

Joined: 9/8/2006
Posts: 1,410
Location: KY, USA
Just create two search pages (one within each domain). They will both call the same macro, but with different values for the 'source' parameter.

cheers,
doug.

MVP 2007-2009 - Official Umbraco Trainer for North America - Percipient Studios
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.