SQL Azure - Substring Searches?

爱⌒轻易说出口 提交于 2019-12-25 09:09:05

问题


SQL Azure does not support SQL Server's Full Text Search feature. Does this mean a text field cannot be indexed to handle substring searches?

For example, if I have a table Emails, with a Message column And I want to find all messages with both the words 'hello' and 'thanks' in them, will the standard index on the message collumn allow me to do this?

CREATE TABLE Emails (
    [Id] bigint  NOT NULL,
    [Message] nvarchar({some number})  NOT NULL
);
GO

CREATE NONCLUSTERED INDEX Messages_Emails ON Emails


my query (using entity) would look like
var niceMessageQuery = Context.Emails.Where(e => e.Message.Contains("hello") && e.Message.Contains("thanks"));

Is there a better way to setup this query?


回答1:


As of April 2015 Full-Text Search is available in Azure Sql Database server version V12: http://azure.microsoft.com/blog/2015/04/30/full-text-search-is-now-available-for-preview-in-azure-sql-database/.




回答2:


Not familiar at all with azure, but is it possible to use a subquery? The inner (sub) query find all records that contain "hello" and the outer query uses that inner query as it's dataset to search for "thanks"?



来源:https://stackoverflow.com/questions/3424627/sql-azure-substring-searches

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!