Forum Discussion

PerBonomi's avatar
8 years ago

Period in query breaks query

Hi everyone, wondering if anyone else has come across this.

 

I run this query and it works fine in API Browser, but in a community component it says the query is null:

 

"SELECT id FROM messages WHERE board.id = 'starkb' AND subject MATCHES 'Twitter Starbase 1.0'"

 

If I cut off the ".0" it works. Seems to be the period.

 

In this case I could query without the last two characters, but long term that could get me the wrong message, depending on where the period shows up.

 

Any way to work around or fix that period problem?

9 Replies

  • Hi PerBonomi  It works fine even with the string having a period(see screenshot).
    It seems to get no message when you put the search string "Twitter Starbase 1.0" and it shows the following has evaluated to null when you try to get ${result.id} .  So can you please try with the count API to make sure it is fetching something.

    <#assign count= rest("2.0","/search?q=" + "SELECT count(*) FROM messages WHERE board.id = 'starkb' AND subject MATCHES 'Twitter Starbase 1.0'"?url).data.count />
    ${count}

     

     


    issue.png
  • PerBonomi's avatar
    PerBonomi
    Boss
    8 years ago
    <#assign count= rest("2.0","/search?q=" + "SELECT count(*) FROM messages WHERE board.id = 'starkb' AND subject MATCHES 'Twitter Starbase'"?url).data.count />
    ${count}

    Gives me 1.

     

    <#assign count= rest("2.0","/search?q=" + "SELECT count(*) FROM messages WHERE board.id = 'starkb' AND subject MATCHES 'Twitter Starbase 1.0'"?url).data.count />
    ${count}

    Gives me 0.

     

    But, the "0" result query in API Browser gives me:

     

  • PerBonomi's avatar
    PerBonomi
    Boss
    8 years ago

    I guess it can't hurt to be sure, but it still gives me 0.

  • PerBonomi - I have created a topic with the same subject and was able to fetch it using API browser and with free marker call well.  Could you please try following. 

     

    1.  Create a topic with the same subject in any other public board and try again the freemarker call. 

    2.  Use API v1 just to verify, if this is working in API V1.

     

  • PerBonomi's avatar
    PerBonomi
    Boss
    8 years ago

    It's the strangest thing. I created a custom forum page with an announcement component, which I use for testing code. This way studio versions doesn't get so cluttered with a gazillion updates.

    On this page I get the error. But, if I create a custom page, with a custom component and stick my code in there, I don't get the error.

     

    I guess for this case I'll just use the custom component and let it remain a mystery.

     

    Thanks for all your feedback in here. 

  • Hi ,

     

    Can you please try this query :-

     

    SELECT id FROM messages WHERE board.id = 'starkb' AND subject MATCHES 'Twitter Starbase 1&#1830'

     

     

    Thanks

     

  • Hi ,

     

    Can you please try this query :-

     

    SELECT id FROM messages WHERE board.id = 'starkb' AND subject MATCHES 'Twitter Starbase 1&#1830'

     

     

    Thanks

     

  • VikasB's avatar
    VikasB
    Boss
    8 years ago

    Gagandeeps

    It never will give the expected output because the search string "Twitter Starbase 1&#183;0"  will never be converted in "Twitter Starbase 1.0". Whole text would be treated as a string including decimal character Unicode. 

     

    PerBonomi  Bit late but it might be helpful for others also.  It seems an error with lithium match case API.  You should reach out to support. But in this case, you could query without the last two characters, it would not get you the wrong messages even where the period shows up as it would fetch those messages also. 

    I performed some test here. It works fine our instance with the text string "Twitter Starbase 1.0" but not with "Twitter Database 1.0", "Twitter History 1.0" etc. (see screenshot)

     

    1. Search Text(Twitter Database) without number

    Result:  It returns the posts having text Twitter or Database or Twitter Database in the subject.

    2.  Search Text(Twitter Database 1.0) with number

    Result: It matches the whole text before the number.  i.e. It returns the posts having Twitter Database or Twitter Database 1.0 in the subject but never Twitter or Database individually.  

     

     

     


    Twitter Starbase.png