Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Aaron 58 posts 406 karma points MVP 2x c-trib
    Feb 22, 2023 @ 18:22
    Aaron
    0

    Examine Escape() does not work

    Can someone tell me why I need to create a raw query to be able to search with Escape()?

    This brings back 0 results:

    if (!string.IsNullOrEmpty(criteria.Colour))
    {
      query = query.And().Field("colour",  criteria.Colour.Escape());
    }
    

    But if I extract the RAW query and run it... It works:

    string stringToParse = query.ToString();
    int indexOfPropertyValue = stringToParse.IndexOf("LuceneQuery:") + 12;
    string rawQuery = stringToParse.Substring(indexOfPropertyValue).TrimEnd('}');
    var response = index.Searcher.CreateQuery("content").NativeQuery(rawQuery).Execute(QueryOptions.SkipTake((criteria.CurrentPage - 1) * criteria.PageSize, criteria.PageSize));
    
  • Nik 1617 posts 7263 karma points MVP 7x c-trib
    Feb 23, 2023 @ 12:45
    Nik
    0

    Hey Aaron,

    What do the two different queries look like?

    Nik

Please Sign in or register to post replies

Write your reply to:

Draft