Copied to clipboard

Flag this post as spam?

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

  • Aaron 47 posts 351 karma points c-trib
    Feb 22, 2023 @ 18:22

    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 1554 posts 6876 karma points MVP 5x c-trib
    Feb 23, 2023 @ 12:45

    Hey Aaron,

    What do the two different queries look like?


Please Sign in or register to post replies

Write your reply to: