0

I have created a fulltext index named messageText on property text of node Message.

CALL db.index.fulltext.createNodeIndex('messageText', ['Message'], ['text'])

In the same node(Message), I have another property named created, that contains the timestamp at which the node was created. Is it possible to alter the index to give more weightage to the recently created messages? That is, if there are 2 identical text values, give a higher score to a node having latest timestamp value.

1 Answers1

1

You could adjust the score yourself.

For example, you can increase the raw score by adding the inverse of the difference between the current time and created:

WITH timestamp() AS now
CALL db.index.fulltext.queryNodes('messageText', 'Hello') YIELD node, score
RETURN node, score + 1.0/(now - node.created) AS adjustedScore

The more distant the created time, the smaller the adjustment.

cybersam
  • 63,203
  • 6
  • 53
  • 76
  • With this, I think sorting by adjustedScore would need db.index.fulltext.queryNodes to return the full dataset. Maybe it's not great for memory consumption. – Davey Jul 21 '23 at 13:37