Use fulltext and ngram in attachment field

Enonic version: 7.2.0
OS: Linux Mint 19.3

Is possible to use the function fulltext and ngram to search inside the contents that have the field attachment?

"attachment": {
  "name": "myfile.pdf",
  "label": "source",
  "binary": "myfile.pdf",
  "mimeType": "application/pdf",
  "size": 180131,
  "text": "My text inside PDF"

This query not works:

ngram('', 'myfile', 'OR')
fulltext('', 'myfile', 'OR')
1 Like

Have you tried
ngram('', 'myfile') OR fulltext('', 'myfile')

This solution works for field.
But I need search in the attachment.text field too.
Exist another alternative to search into this field?

Hi, from looking at indexing instructions of a regular media i get the following:

    "path": "attachment.text",
    "config": {
      "decideByType": false,
      "enabled": true,
      "nGram": true,
      "fulltext": true,
      "includeInAllText": false,
      "path": false,
      "indexValueProcessors": [
      "languages": [

As you can see, this indicates that the property attachment.text is indexed with both ngram and fulltext options. As such, this should normally work fine.
Simply look at the low level data of your item i.e. using data toolbox to get insight on how the item is indexed.

1 Like

Sorry, I got confused with this field. The field attachment.text works correctly.