-
Notifications
You must be signed in to change notification settings - Fork 32
Description
Cosmos DB just launched a new feature: Full-text search in Azure Cosmos DB for NoSQL
It would be great if this could be implemented in cosmosdb-server as well to replicate production environments as closely as possible.
Query functions:
FullTextContains
In this example, we want to obtain the first 10 results where the phrase "red bicycle" is contained in the property c.text.
SELECT TOP 10 *
FROM c
WHERE FullTextContains(c.text, "red bicycle")
FullTextContainsAll
In this example, we want to obtain first 10 results where the keywords "red" and "bicycle" are contained in the property c.text, but not necessarily together.
SELECT TOP 10 *
FROM c
WHERE FullTextContainsAll(c.text, "red", "bicycle")
FullTextContainsAny
In this example, we want to obtain the first 10 results where the keywords "red" and either "bicycle" or "skateboard" are contained in the property c.text.
SELECT TOP 10 *
FROM c
WHERE FullTextContains(c.text, "red") AND FullTextContainsAny(c.text, "bicycle", "skateboard")
FullTextScore
In this example, we want to obtain the first 10 results where "mountain" and "bicycle" are included, and sorted by order of relevance. That is, documents that have these terms more often should appear higher in the list.
SELECT TOP 10 *
FROM c
ORDER BY RANK FullTextScore(c.text, "bicycle", "mountain")