Copied to clipboard

Flag this post as spam?

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


  • Aaron 59 posts 407 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 1625 posts 7295 karma points MVP 7x c-trib
    Feb 23, 2023 @ 12:45
    Nik
    0

    Hey Aaron,

    What do the two different queries look like?

    Nik

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies