# @IndexingDependency : Can an Index depend on another index field?

**URL:** <https://discourse.hibernate.org/t/indexingdependency-can-an-index-depend-on-another-index-field/5791>\
**Category:** Hibernate Search\
**Created:** [October 21, 2021, 7:17am UTC](https://discourse.hibernate.org/t/indexingdependency-can-an-index-depend-on-another-index-field/5791 "2021-10-21T07:17:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fraf](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/fraf/32/1614_2.png) [@fraf](https://discourse.hibernate.org/u/fraf)\
**Post date:** [October 21, 2021, 7:17am UTC](https://discourse.hibernate.org/t/indexingdependency-can-an-index-depend-on-another-index-field/5791/1 "2021-10-21T07:17:33Z")

</div>

Hi everyone,

I have an Indexed method like follows :

```auto
@Transient
@GenericField(name = MentionMicenIndexed_.LIBELLE_TITLE)
public String getLibelleTitle() {
		return String.format("%s - %s",
				estExecutoire() ? getLibelle().toUpperCase() : getNature().getLibelleCourt().toUpperCase(),
				getSearchExtendedLabel());
	}

```

But the method `getSearchExtendedLabel()` is already a `@FullTextField` computed with entity attributs, having its `@IndexingDependency`.  
Do this method `getLibelleTitle()` has, in addition to define its own `@IndexingDependency`, to include (with copy paste) all `@IndexingDependency` of method `getSearchExtendedLabel()` ?

thanks.

---

<div class="post-metadata">

**Author:** ![yrodiere](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/yrodiere/32/1760_2.png) [@yrodiere](https://discourse.hibernate.org/u/yrodiere)\
**Post date:** [October 21, 2021, 7:31am UTC](https://discourse.hibernate.org/t/indexingdependency-can-an-index-depend-on-another-index-field/5791/2 "2021-10-21T07:31:01Z")

</div>

Hey,

> [@fraf](#):
>
> Do this method `getLibelleTitle()` has, in addition to define its own `@IndexingDependency` , to include (with copy paste) all `@IndexingDependency` of method `getSearchExtendedLabel()` ?

No it does not.

This:

```auto
@Transient
@GenericField(name = MentionMicenIndexed_.LIBELLE_TITLE)
@IndexingDependency(derivedFrom = {
        @ObjectPath(@PropertyValue(propertyName = "searchExtendedLabel"))
})
public String getLibelleTitle() {
    //...
}

```

will recursively add the dependencies of `searchExtendedLabel` to `libelleTitle`.

Note that in general, if you have doubts about what works or not, you can just try it 🙂

---

<div class="post-metadata">

**Author:** ![fraf](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/fraf/32/1614_2.png) [@fraf](https://discourse.hibernate.org/u/fraf)\
**Post date:** [December 13, 2021, 11:07am UTC](https://discourse.hibernate.org/t/indexingdependency-can-an-index-depend-on-another-index-field/5791/3 "2021-12-13T11:07:56Z")

</div>

I discovered that in that case, there must exist a getter method named `getSearchExtendedLabel`. The method name (`getSearchExtendedLabel`) and index name (`searchExtendedLabel`) are then linked.

---

<div class="post-metadata">

**Author:** ![yrodiere](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/yrodiere/32/1760_2.png) [@yrodiere](https://discourse.hibernate.org/u/yrodiere)\
**Post date:** [December 13, 2021, 12:41pm UTC](https://discourse.hibernate.org/t/indexingdependency-can-an-index-depend-on-another-index-field/5791/4 "2021-12-13T12:41:40Z")

</div>

> [@fraf](#):
>
> I discovered that in that case, there must exist a getter method named `getSearchExtendedLabel`

Your very first post was implying that the method `getSearchExtendedLabel` exists:

> [@fraf](#):
>
> But the method `getSearchExtendedLabel()` is already a `@FullTextField` computed with entity attributs

I’m not following your problem, but it seems you’ve solved it, so… all is well that ends well, I guess?

---

<div class="post-metadata">

**Author:** ![fraf](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/fraf/32/1614_2.png) [@fraf](https://discourse.hibernate.org/u/fraf)\
**Post date:** [December 13, 2021, 2:10pm UTC](https://discourse.hibernate.org/t/indexingdependency-can-an-index-depend-on-another-index-field/5791/5 "2021-12-13T14:10:50Z")

</div>

Yes it is ok. Just another use case reveal that. I was lucky for `searchExtendedLabel` 😛
