Full Text Search syntax errors

Hi,

I have enabled full text search and was able to obtain some results. However, there are some parts of the Lucene syntax that are always giving me errors.

I am trying to test the Lucene syntax supported by Stardog as described in Home | Stardog Documentation Latest and org.apache.lucene.queryparser.classic (Lucene 5.3.0 API)

(1) The proximity syntax returns an error

select *
from tag:stardog:api:context:all
where {
(?text ?score) tag:stardog:api:property:textMatch ("semantic web"~5)
}
order by desc(?score) ?text

(2) The boolean operator syntax returns an error

select *
from tag:stardog:api:context:all
where {
(?text ?score) tag:stardog:api:property:textMatch ("jakarta apache" AND "Apache Lucene")
}
order by desc(?score) ?text

image

(3) The fuzzy syntax returns an error

select *
from tag:stardog:api:context:all
where {
(?text ?score) tag:stardog:api:property:textMatch ("semantic"~1 2.0 1) #
}
order by desc(?score) ?text

In fact, most of the Lucene syntax does not seem to be valid in Stardog Studio. Except the following in which I am including minimum score and limit.

select *
from tag:stardog:api:context:all
where {
(?text ?score) tag:stardog:api:property:textMatch ('CK Hutchison Holdings Ltd' 6.0 1)
}
order by desc(?score) ?text

What is the proper way to embed in SPARQL all the Lucene syntax?

Thanks

The Lucene syntax query needs to be contained within the quotes just to make it a valid sparql query but I'm not positive how you escape the quotes withing the query but I'm guessing it's something like the following.

(?text ?score) tag:stardog:api:property:textMatch ("semantic web"~5)

should be

(?text ?score) tag:stardog:api:property:textMatch ("\"semantic web\"~5")

1 Like

Hi Zachary,

You are right. I am now getting some results. Thanks!

select *
from tag:stardog:api:context:all
where {
(?text ?score) tag:stardog:api:property:textMatch (""semantic web"~5")
}
order by desc(?score) ?text

image

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