cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

FullText match ranks exact match string much lower

lingvisa
Graph Fellow
CALL db.index.fulltext.queryNodes("NameIndex", "英雄联盟")

YIELD node, score

RETURN properties(node)['name'] as name, score LIMIT 62

My query is "英雄联盟", which is supposed to match the 'name' property of a game node. There are several instances of nodes with exact match of this string. However, the fulltext results rank the first exact match at the rank of 61, which should be at the very top, since it's an exact match. All other results ranked before it are partial match. Is it possible to always get exact match at the very top when fullText is used?

3 REPLIES 3

Hi,

Are you using ORDER BY score DESC? Sometimes the query gives you the result not ordered unless you state so.

Hi there, I actually have a query that is having this issue as well. My query uses boosting in general, but none of the boosters are present... I have tried setting up the query a few different ways... but it continues to be true that for the string "howard hewett" words with only "hewett" and a second word that is legitimately "kawaikapuo" scores better than an exact matched "howard hewett" I've tried putting 's around the name. I've done it for each term even. I also have done a fuzzy matching and it continues to match to the kawaikapuo record dead equal to the howard hewett record.

I have been reading, but I really can't for the life of me fathom how an exact match gets beat out by such a vast difference (with nothing else that would "boost" the matches)

I fixed this for my own situation, right after posting exasperatedly on this thread -- here is what I did...
At least in my case the issue was the way i was using a LIMIT based on those scores. Essentially, I was applying a limit to the "top 5" by score desc and I was doing that outside of the call to use the

CALL db.index.fulltext.queryNodes('queryINDEX','querystring') ... YIELD nd, score , with nd.account, max(score) as sc order by sc desc limit 5

However, once I added in the limit to the options and expanded that to say 100 -- I actually started getting scores that I would have expected. It also is about 20 times faster
CALL db.index.fulltext.queryNodes('queryINDEX','querystring', {limit:100}) ... YIELD nd, score , with nd.account, max(score) as sc order by sc desc

Maybe that will help you or others... although i am not technically sure why this worked this way?

Best regards,
Michael