Extending Locator package to search multiple document types?
I currently have the Locator package working to display events. However, we have made changes to the site where we now have three different event types as separate document types. I would like the locator search to show results of all three document (event) types.
Currently the code for executing the macro is defined as follows:
I just wanted to see what the syntax would be (if possible) to make it search three different document types. Instead of searching only for 'EventItem', I would also like it to search for 'RegionalEventItem' and for 'CountyEventItem' document types. Is that doable?
Is the Event holder node only listing the three different event types or does it have other document types like textpages etc. listed under it as well? Otherwise I think that it's really just a matter of removing [@nodeTypeAlias = 'EventItem']
If the holder node contains many different document types, try writing this: [@nodeTypeAlias = 'EventItem'][@nodeTypeAlias = 'OtherEventitemOne'][@nodeTypeAlias = 'OtherEventItemTwo']...I think this should work...otherwise this should work: [@nodeTypeAlias = 'EventItem' and @nodeTypeAlias = 'EventItemTwo' and @nodeTypeAlias = 'EventItemThree']
Thanks for the reply. I tried all of those, but it still didn't produce any results showing Regional Events and County Events. I'm thinking that I might need to change this part of the code in some way:
XPath="/root/descendant::node
Note that the folder structure of the site is as follows:
Regional Events folder - Region Name folders - Year folders - Month folders - Regional Event Items
County Events folder - County Name folders - Year folders - Month folders - County Event Items
I have search forms on all pages that have lists of the various events where people can do a proximity search for events near them. So for a page in the Events folder to find Regional Events, it would have to look in a different folder area within the site. I was thinking /root/descendent::node would find them all, but maybe that just takes it back to the main Events folder, for example, instead of back to the root folder of the entire site. I'm not sure as I'm extremely inexperienced with XSLT. But I know the search must be conducted sitewide, not just in the folder area the current page may reside in.
Does the /root/descendent::node code have to be changed to find nodes anywhere in the entire site?
Actually, I just did a test using a search form from the main Regional Events page, and the results it showed still only used the initial eventItem document alias/type. So it is still only looking for the one event type.
I did that just to see if I could get any county events to show up in the results at all, and that STILL showed only the statewide events (eventItem). I'm now completely baffled by this and back to discouraged that this may be much more difficult to solve than I was expecting. I was thinking it would just be a matter of changing this code in where the macro gets called.
Something else must be in the coding somewhere that is bringing the regular eventItem nodeTypeAlias in as what is being returned in the results.
OK, I figured out another place where this must be changed. The reason it still showed eventItem on the above test is there is additional code in a macro that is on the Locator Results page that filters by nodeType. I was able to get that to change what displays on the results page among any of the three event types, but I was not able to get it to display more than one event type. I could change among 'EventItem' 'CountyEventItem' and 'RegionalEventItem' and it would display the results as I wanted them to appear. But I couldn't get it to work using more than one nodeType. I'm sure this is due to a syntax issue.
The macro code displaying the results on the Location Results page is as follows:
<div umb_locationalias="locator" umb_useaddress="0" umb_unitinkm="0" umb_macroalias="Locator" umb_xpath="/root/descendant::node\r\n[@nodeTypeAlias = 'EventItem']" ismacro="true" umbversionid="[removed in case including this is a security problem]" umbpageid="1331" onresizestart="return false;" title="This is rendered content from macro" class="umbMacroHolder"><!-- startUmbMacro --><span>This macro does not provides rendering in WYSIWYG editor</span><!-- endUmbMacro --></div>
So if I could get the correct syntax to use in place of
Extending Locator package to search multiple document types?
I currently have the Locator package working to display events. However, we have made changes to the site where we now have three different event types as separate document types. I would like the locator search to show results of all three document (event) types.
Currently the code for executing the macro is defined as follows:
I just wanted to see what the syntax would be (if possible) to make it search three different document types. Instead of searching only for 'EventItem', I would also like it to search for 'RegionalEventItem' and for 'CountyEventItem' document types. Is that doable?
Hi wildlife
Is the Event holder node only listing the three different event types or does it have other document types like textpages etc. listed under it as well? Otherwise I think that it's really just a matter of removing [@nodeTypeAlias = 'EventItem']
If the holder node contains many different document types, try writing this: [@nodeTypeAlias = 'EventItem'][@nodeTypeAlias = 'OtherEventitemOne'][@nodeTypeAlias = 'OtherEventItemTwo']...I think this should work...otherwise this should work: [@nodeTypeAlias = 'EventItem' and @nodeTypeAlias = 'EventItemTwo' and @nodeTypeAlias = 'EventItemThree']
/Jan
Thanks for the reply. I tried all of those, but it still didn't produce any results showing Regional Events and County Events. I'm thinking that I might need to change this part of the code in some way:
Note that the folder structure of the site is as follows:
Homepage folder
I have search forms on all pages that have lists of the various events where people can do a proximity search for events near them. So for a page in the Events folder to find Regional Events, it would have to look in a different folder area within the site. I was thinking /root/descendent::node would find them all, but maybe that just takes it back to the main Events folder, for example, instead of back to the root folder of the entire site. I'm not sure as I'm extremely inexperienced with XSLT. But I know the search must be conducted sitewide, not just in the folder area the current page may reside in.
Does the /root/descendent::node code have to be changed to find nodes anywhere in the entire site?
Actually, I just did a test using a search form from the main Regional Events page, and the results it showed still only used the initial eventItem document alias/type. So it is still only looking for the one event type.
Hi Wildlife
Which version of Umbraco are you using? If it's 4.5.x or later then it does probably not return anything since the XML schema has changed.
Then the code should maybe read this: root/descendant::*[@IsDoc]...
/Jan
No, this site is still on 4.0.3.
The strangest thing is I just tried changing it to:
OK, I figured out another place where this must be changed. The reason it still showed eventItem on the above test is there is additional code in a macro that is on the Locator Results page that filters by nodeType. I was able to get that to change what displays on the results page among any of the three event types, but I was not able to get it to display more than one event type. I could change among 'EventItem' 'CountyEventItem' and 'RegionalEventItem' and it would display the results as I wanted them to appear. But I couldn't get it to work using more than one nodeType. I'm sure this is due to a syntax issue.
The macro code displaying the results on the Location Results page is as follows:
So if I could get the correct syntax to use in place of
that would show all three document types in the results here, that would likely solve it.
is working on a reply...