Skip to content

The full-text query parameter for Fulltext Query String is not valid. #16

Description

@erossini

HI,
I have an issue with full-text. The sql script I execute on the server is

select * from dbo.ufn_search('(ISABOUT("mysearch") OR "mysearch")')

My function in the context is

[DbFunction("WordBankContext", "ufn_Search")]
public IQueryable<Search> FullSearch(string search)
{
    if (!string.IsNullOrEmpty(search))
    {
        string[] tmp = search.Split(' ');
        search = "";
        foreach (string s in tmp)
        {
            if (!string.IsNullOrEmpty(search))
                search += " AND ";
            search += $"(ISABOUT(\"{s}\") OR \"{s}\")";
            }
    }

    var searchParameter = search != null ? new ObjectParameter("search", search) 
                          : new ObjectParameter("search", typeof(string));
    return ((IObjectContextAdapter)this)
               .ObjectContext.CreateQuery<Search>(string.Format("[{0}].{1}", 
                                                  GetType().Name, 
                                                  "[ufn_Search](@search)"), 
                                                  searchParameter);
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions