OneHop and TwoHop Queries

Top  Previous  Next

The one and two hop helpers are used to provide navigation links from the page currently being viewed by the user to other associated pages in the topic. This functionality is available through the use of the NetworkedPlanet.EPiServerModule.TopicMapQueryHelper class.

To instantiate the class you need to initialize it specifying whether the control is rendering in Edit mode (for editors) or View mode (for normal users).

To initialize the query helper in view mode you can use one of these options:

TopicMapQueryHelper helper = new TopicMapQueryHelper();  // Default is View mode

TopicMapQueryHelper helper = new TopicMapQueryHelper(TopicMapQueryHelper.QueryMode.View);

TopicMapQueryHelper helper = new TopicMapQueryHelper(true);

To initialize the query helper in edit mode use one of these options:

TopicMapQueryHelper helper = new TopicMapQueryHelper(TopicMapQueryHelper.QueryMode.Edit);

TopicMapQueryHelper helper = new TopicMapQueryHelper(false);

The difference between View mode and Edit is mode is the filters that are applied to results from running a query against the topic map. The following filters, and their purposes are predefined by the QueryHelper:

Filter

Description

Active in Mode(s)

ExcludePagesNotInRecycleBinHandler

Excludes pages from results sets where the page is in the recycle bin.

View, Edit

ExcludePagesWithNoAccessHandler

Excludes pages from results sets where the user does not have access to the page.

View, Edit

ExcludeUnpublishedPagesHandler

Excludes pages from results sets that are not published.

View

ExcludeUnpublishedAssociationsHandler

Excludes pages from results sets where the page was found by traversing an association that is not published.

View

ExcludeOriginalPageHandler

Excludes pages from results sets that are the same page as the original page that the query was made from.

View, Edit

ExcludeDeletedAssociationsHandler

Excludes pages from results sets where the page was found by traversing an association marked for deletion.

Edit

Query Helper Filters list, description and which modes they are active within.

There is a third mode: QueryMode.None, which initializes the query helper with no filters active.

You are also able to define your own filters and add them to the query helper. Filter may be added and removed using:

helper.PageValidationHandlers += new ValidatePageHandler(...); // add a filter

helper.PageValidationHandlers -= existing page validation handler; // remove a filter

The provided validation handlers are declared within the query helper as public static read-only members. See the API documentation for more information on how to implement your own page validation handlers.