Searching ids with fulltext

Enonic version: 6.12.0
OS: Linux

Hi!

When I try to search with the fulltext function for a related object, query returns me nothing. Also, I can not use single attribute, as this value might be written into a different attributes, so I use “data.*”. I was also testing this in a RepoXPlorer app. Here is a quick example of how it looks:

fulltext(‘data.*’, ‘a28e784e-0d71-4939-8db9-bf8b88484349’, ‘AND’)

What am I doing wrong?
Thank you!

Hi!

Your problem is that fulltext searching for reference IDs makes no sense. Fulltext search is useful for searching plain text. I’ll try to explain why:

  1. Fulltext is a special search function designed for free-text search Google style. For instance it will attempt splitting up the text you pass and apply a list of effects such as transliteration etc before evaluating the search and also performing result ranking.
  2. To get matches for a fulltext search on a property, the property must actually be fulltext processed at index time. By default reference properties are not fulltext indexed as you normally only want to do explicit searches on these properties

If I understand correctly, what you want to do is to find all nodes with an outbound reference to your defined ID? The best way to solve this is by doing a simple query on the _references property. This hold an array with all outbound references from the node. I.e. _references = ‘a28e784e-0d71-4939-8db9-bf8b88484349’

This is also documented here: http://xp.readthedocs.io/en/stable/developer/search/query-references.html

1 Like

Thank you very much! :slight_smile: This is exactly what I needed. Case can be closed.

1 Like