# Search against Lucene index with pointeritem not working

**URL:** <https://forum.litium.com/t/search-against-lucene-index-with-pointeritem-not-working/2234>\
**Category:** Questions\
**Created:** [October 4, 2021, 12:21pm UTC](https://forum.litium.com/t/search-against-lucene-index-with-pointeritem-not-working/2234 "2021-10-04T12:21:56Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![marten.olofsson](https://avatars.discourse-cdn.com/v4/letter/m/7cd45c/32.png) [@marten.olofsson](https://forum.litium.com/u/marten.olofsson)\
**Post date:** [October 4, 2021, 12:21pm UTC](https://forum.litium.com/t/search-against-lucene-index-with-pointeritem-not-working/2234/1 "2021-10-04T12:21:56Z")

</div>

Hello!

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

```auto
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]_

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [October 11, 2021, 9:04am UTC](https://forum.litium.com/t/search-against-lucene-index-with-pointeritem-not-working/2234/2 "2021-10-11T09:04:22Z")

</div>

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

```cs
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.

---

<div class="post-metadata">

**Author:** ![marten.olofsson](https://avatars.discourse-cdn.com/v4/letter/m/7cd45c/32.png) [@marten.olofsson](https://forum.litium.com/u/marten.olofsson)\
**Post date:** [October 19, 2021, 8:06am UTC](https://forum.litium.com/t/search-against-lucene-index-with-pointeritem-not-working/2234/3 "2021-10-19T08:06:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [October 19, 2021, 12:36pm UTC](https://forum.litium.com/t/search-against-lucene-index-with-pointeritem-not-working/2234/4 "2021-10-19T12:36:42Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![marten.olofsson](https://avatars.discourse-cdn.com/v4/letter/m/7cd45c/32.png) [@marten.olofsson](https://forum.litium.com/u/marten.olofsson)\
**Post date:** [October 22, 2021, 9:45am UTC](https://forum.litium.com/t/search-against-lucene-index-with-pointeritem-not-working/2234/5 "2021-10-22T09:45:43Z")

</div>

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?)

---

<div class="post-metadata">

**Author:** ![NilsN](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/nilsn/32/302_2.png) [@NilsN](https://forum.litium.com/u/NilsN)\
**Post date:** [October 22, 2021, 10:04am UTC](https://forum.litium.com/t/search-against-lucene-index-with-pointeritem-not-working/2234/6 "2021-10-22T10:04:43Z")

</div>

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](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/0456e27dc618b3f255834e534d662ff60918cd33.png)

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:

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/76588751b69e00f16f481b493cad0bd8dc893c4b.png)

---

<div class="post-metadata">

**Author:** ![marten.olofsson](https://avatars.discourse-cdn.com/v4/letter/m/7cd45c/32.png) [@marten.olofsson](https://forum.litium.com/u/marten.olofsson)\
**Post date:** [October 22, 2021, 10:58am UTC](https://forum.litium.com/t/search-against-lucene-index-with-pointeritem-not-working/2234/7 "2021-10-22T10:58:58Z")

</div>

Thanks for the explanation! @NilsN🙂

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 🙂

Best,  
Mårten

---

<div class="post-metadata">

**Author:** ![NilsN](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/nilsn/32/302_2.png) [@NilsN](https://forum.litium.com/u/NilsN)\
**Post date:** [October 22, 2021, 11:17am UTC](https://forum.litium.com/t/search-against-lucene-index-with-pointeritem-not-working/2234/8 "2021-10-22T11:17:16Z")

</div>

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.](https://code.google.com/archive/p/luke/)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)\
**Post date:** [November 19, 2021, 11:17am UTC](https://forum.litium.com/t/search-against-lucene-index-with-pointeritem-not-working/2234/9 "2021-11-19T11:17:33Z")

</div>

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