How can I add a number field to the fulltext search?

It seems that Nuxeo is only using string fields to build the fulltext . Maybe using the fulltextExcludedTypes but I cannot find it anywhere being set.

Is there a way I can incorporate number fields, e.g. a year, into the fulltext index? Or specifiy the fields that will go into?

Update: I am using VCS with Postgres

0 votes

3 answers

815 views

ANSWER



For anybody interested: I ended up using a hidden schema text field storing the int year as a string. Because it is a text, it is added to the fulltext search. I use a listener to update that field on any beforeDocumentModification event

0 votes



Hi Gregory,

sorry for the late reply. Did not have the time to look into that until now. Actually, I am not using Elasticsearch, but Postgres' full-text search would be enough for me. Unfortunately, it seems that Nuxeo ignores fields that are not of type string or binary (c.f. FulltextConfigurationFactory.java:176). At least that's my conclusion after getting a

ERROR [FulltextConfigurationFactory] Ignoring property 'datacite:year' with bad type org.nuxeo.ecm.core.schema.types.primitives.LongType@8b41ad in fulltext configuration: year

(datacite:year is a custom field of ours)

My overall goal is to be able to search by year but also in a combined search term like “contract 2020”. Do you have any ideas on how to accomplish that?

Best, Konrad

0 votes



Hello,

You should adapt the Elasticsearch mapping as described here: https://doc.nuxeo.com/nxdoc/configuring-the-elasticsearch-mapping/#includeexcluding-a-field-from-the-full-text-search

As you correctly pointed out, the default full text field only indexes text fields

Regards

0 votes