Forum Discussion

citizenelah's avatar
2 years ago

LiQL match is not accurate

Our data migration to khoros had a few misses, mainly, anything in our old forums with <code></code> tags is now a jumbled mess that I can fix manually by changing that to <li-code></li-code> in the editor. But we have over 10k of these, so that's not possible manually. I'd like to search for each message with the code tag (which as an aside, is interesting because in the stored data it's not the same view I see in the editor, it's stored as "<pre class=\"lia-code-sample language-tcl\"><code></code></pre>" and my old <code> tags are stored as <CODE></CODE>)

Anyway...to my point. I have this query:

 

SELECT id, view_href, body, current_revision FROM messages where body MATCHES '<CODE' LIMIT 1

 

I would expect it to only find the literal <CODE string in the body of my messages, but it seems to be matching any case of code and doesn't care at all about the less than sign. Here's the body of the first message it matched:

 

"body" : "<H5 contenteditable=\"false\" id=\"toc-hId-1990738234\">Code is community submitted, community supported, and recognized as ‘Use At Your Own Risk’.</H5>\n<H3 contenteditable=\"false\" id=\"toc-hId-216654393\">Short Description</H3>\n<P>Please enter a short and descriptive title for your snippet.</P>\n<H3 contenteditable=\"false\" id=\"toc-hId-217577914\">Problem solved by this Code Snippet</H3>\n<P>Briefly describe the problem your snippet solves.</P>\n<H3 contenteditable=\"false\" id=\"toc-hId-218501435\">How to use this Code Snippet</H3>\n<P>Tell others how to use this code snippet.</P>\n<H3 contenteditable=\"false\" id=\"toc-hId-219424956\">Code Snippet Meta Information</H3>\n<OL>\n<LI>Version:</LI>\n<LI>Coding Language:</LI>\n</OL>\n<H3 contenteditable=\"false\" id=\"toc-hId-220348477\">Full Code Snippet</H3>\n<P>Enter your code snippet here or attach a file below.</P>",
     

 

Any hints would be appreciated! 

  • There's some good info here Search API Overview (khoros.com). I think you want to add double quotes inside the single quotes to signify that you want an exact match like this.

    SELECT id, view_href, body, current_revision FROM messages where body MATCHES '"<CODE"' LIMIT 1

     

     

    • citizenelah's avatar
      citizenelah
      Ace

      Thanks for trying to help! I had read that but he '" "' seemed to be for whitespace to make an exact match. That said, I tried that and no difference in results. code is being matched without the less than sign and case is being ignored.

      • Malcolm-M's avatar
        Malcolm-M
        Boss

        Had a look and can't see any way to escape the < including trying a double character or a backslash, etc. I can't see any method of using a regex query either.

        Maybe one for a support ticket to get a definitive answer. I'd be interested to find out if it's possible.