Enonic version: 6.15.5
OS: Windows 10
I need to make a query to get objects, based on a text. I used fulltext for this and works. This is an example of this object:
This is an example of a query:
fulltext('*.text', 'myword', 'AND')
When I run this query, I need to search too in the field ‘attachment.text’ of the file, and return the object a9da5140-87ae-49a5-bf6e-b5f17cb438d7 if this field has the text ‘myword’.
In Enonic I can indexing the field ‘attachment.text’ when I make the search in the object that I select the attachment?
- I using the content API.
- Yes, the content is media.
When I search, the media is returned, but I need the content that references the media be returned.
For example, in my example, I need that the content a9da5140-87ae-49a5-bf6e-b5f17cb438d7 be returned, even if the text is in the file.
I see, you will need to run two queries to do this:
- Fulltext search across the media you want to match, then
- Pass the id’s of the media hits to a new query type “_references in (“a9da5…”,“id2”,“id3” etc )”
_references is a dynamic field available in all contents aggregating all outbound references. So, if it is linking to your hits from search 1, you will get it in search 2.