# @GenericField and full-text search

**URL:** <https://discourse.hibernate.org/t/genericfield-and-full-text-search/7139>\
**Category:** Hibernate Search\
**Created:** [January 13, 2023, 10:47am UTC](https://discourse.hibernate.org/t/genericfield-and-full-text-search/7139 "2023-01-13T10:47:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tony](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/tony/32/2448_2.png) [@Tony](https://discourse.hibernate.org/u/Tony)\
**Post date:** [January 13, 2023, 10:47am UTC](https://discourse.hibernate.org/t/genericfield-and-full-text-search/7139/1 "2023-01-13T10:47:52Z")

</div>

HI again, i dont know if i should open new topic.  
i have almost migrated from 5.11 to 6. But i have a minor problem yet.  
The searching with letters not working for me.

> final SearchPredicateFactory pf;  
> pf.match().field(“fieldName”).matching(“string”).toPredicate();

it works only with UPPERCASE letter. eq. TABLE and not table.  
i am using the annotation @GenericField(sortable = Sortable.YES) for this field.

---

<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:** [January 13, 2023, 10:52am UTC](https://discourse.hibernate.org/t/genericfield-and-full-text-search/7139/2 "2023-01-13T10:52:49Z")

</div>

Hi,

Please use new topics for new questions. I moved your message this time.

`@GenericField` won’t give you full-text search, you need to use `@FullTextField`. See [Hibernate Search 6.1.7.Final: Reference Documentation](https://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#mapper-orm-directfieldmapping-annotations)

And since you also needs sorts, and that’s not possible for full-text fields, you will need _two_ fields: one for full-text search and one for sorts. So, something like:

```auto
@FullTextField
@GenericField(name = "fieldName_sort", sortable = Sortable.YES)
private String fieldName;

```

See [Hibernate Search 6.1.7.Final: Reference Documentation](https://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#mapper-orm-directfieldmapping-basics)

---

<div class="post-metadata">

**Author:** ![Tony](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/tony/32/2448_2.png) [@Tony](https://discourse.hibernate.org/u/Tony)\
**Post date:** [January 13, 2023, 11:44am UTC](https://discourse.hibernate.org/t/genericfield-and-full-text-search/7139/4 "2023-01-13T11:44:36Z")

</div>

My bad ! It works fine … Thank you again !!

---

<div class="post-metadata">

**Author:** ![Tony](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/tony/32/2448_2.png) [@Tony](https://discourse.hibernate.org/u/Tony)\
**Post date:** [January 13, 2023, 12:18pm UTC](https://discourse.hibernate.org/t/genericfield-and-full-text-search/7139/5 "2023-01-13T12:18:52Z")

</div>

Is it bad practise to have 5000+ properties with  
@FullTextField  
@GenericField(name = “fieldName\_sort”, sortable = Sortable.YES) ?

The size of indexes will be too high or is it the same with a simple @GenericField(sortable = Sortable.YES)?

---

<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:** [January 16, 2023, 7:54am UTC](https://discourse.hibernate.org/t/genericfield-and-full-text-search/7139/6 "2023-01-16T07:54:13Z")

</div>

Are you being serious? 🙂

> [@yrodiere](#):
>
> Please use new topics for new questions.

---

<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:** [January 16, 2023, 7:55am UTC](https://discourse.hibernate.org/t/genericfield-and-full-text-search/7139/7 "2023-01-16T07:55:05Z")

</div>

Closed on January 16, 2023, 7:55am UTC


