Search against Lucene index with pointeritem not working

Hello!

I’m trying to add an ExcludeTags to a lucene search request like this:

excludeClause.Tags.Add(new Tag(
                TagNames.GetTagNameForProperty(PageFieldNameConstants.ExcludeBrands), Guid.Parse("44bed877-665b-4419-a8ec-434e663d79e4")));

And then add it to the request like so:

request.ExcludeTags.Add(excludeClause);

and PageFieldNameConstants.ExcludeBrands is a multiselect of pointeritems. For non obvious reason the page is NOT excluded from the result. I have tried rebuilding the index and verified that it gets updated.

I am running the request against the SearchDomains.Pages

Similar approach have worked for other types of queries.

Litium version: [7.6.3]

2 Likes

The pointer is using the following code during the indexing of the pointer value

var pointerValue = value is PointerPageItem item ? item.EntitySystemId + "," + item.ChannelSystemId : value.EntitySystemId.ToString();

If your pointer is a page pointer you need to do the same logic for the filtering.

2 Likes

Thank you for the reply. I have tested that without success. :frowning:

Not sure if the page pointer that you testing with is only pointing to a page or if that is pointing to a page in a specific channel. If you try to use Guid.Empty as the channel system id, will that make any difference?

1 Like

I don’t completely understand why but your suggestion acutally worked! It would be appreciated with a more detailed explanation why this is if possible? (IE - have i configured the field incorrecly or is this the way it should be done?)

When you’re using a page pointer you can either point to just a page or to a page on a specific channel (like if you wanted to explicitly link to a page on the English channel). If you’re not using a specific channel the page link will be resolved in context of the current channel. See below how to access the channel specific option.

image

The page and channel system id is stored together with for that field in the format PageGuid,ChannelGuid. If no specific channel is selected, Guid.Empty is used in its place Example from index:

1 Like

Thanks for the explanation! @NilsN :slight_smile:

I have a hard time following this

If no specific channel is selected

Does that mean that: if you selected a page that is present in the same channel as you are editing the channelId will be an empty guid?

Also - what are you using to be able to see the index like that? Seems extremely helpful :slight_smile:

Best,
Mårten

Let’s say you have two channels - one in English and one in Swedish. They use the same website so they both have the same set of pages available.

The most common way to add a page for a pointer field is that we only selected the page and let the channel be contextual, so the page will be fetched using the same channel that we are currently on. So on the English channel you would get back an URL for that channel and vice versa on the Swedish one. In this scenario, we will store Guid.Empty together with the page id.

But you can also specifically say that you want to link to a certain page on the English channel, in that case we will get the English URL even when we are on the Swedish channel. Here we would have the actual channel system id stored together with the page id.

I used Luke (v.3.5.0) to look at the index on disk: Google Code Archive - Long-term storage for Google Code Project Hosting.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.