Search and SPARQL textmatch return different results


When I run the following two queries, I would have expected to retrieve the exact same results:

  1. stardog query search -q "Person" -l 100 mydb

  2. stardog query mydb "SELECT DISTINCT ?s ?score WHERE { ?s ?p ?l. (?l ?score) <tag:stardog:api:property:textMatch> ('Person' 100). } ORDER BY DESC(?score)

However, even though many results have the exact some score, some don’t. I have a literal in the db which has the value “”.

In case 1) the returned score is 11.239, whereas in 2) the returned score is 1.123 for the corresponding subject.

From my dataset, it is obvious that 1), i.e. the higher score, must be correct, and that 2) is too low.

Is there something wrong with my SPARQL query, or am I missing something?

I observed the same problem with stardog v5.3.2 and v5.2.2.

Thanks for your help!

Are you able to provide a minimal data set that can reproduce this issue? If I load just one triple with that literal as the object I see the same results for those 2 queries…

I tried to create a minimal data set, and while doing so I observed that the SPARQL textmatch appears to be buggy only when the score is greater than 10. Would it be possible for you to create a dataset for yourself, in which a search query has a score > 10 and to observe the behavior for the SPARQL variant? Otherwise I will work on an example that I can share with you.

I noticed a pattern - too bad I didn’t realise it before. The first digit simply gets lost when the number is >10.

In the example of my first post, 11.23 became 1.23. In other examples I created 10.6 became 1.06 etc.

My assumption is that this is a bug?

Can you confirm that there isn’t an E1 at the end of the lower score? Often the default output for numbers in a SPARQL query is in scientific notation. It would explain why the difference you note is a power of ten.

It’s there! Thanks, I was not aware of this.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.