Copied to clipboard

Flag this post as spam?

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


  • Aaron 57 posts 405 karma points MVP 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 1593 posts 7151 karma points MVP 6x 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