Forum Discussion

Akenefick's avatar
Akenefick
Genius
9 months ago

API V2 Search Bugs and Documentation Errors

Hi

First the documentation error which will be relevant to the bugs I believe I've found.

Documentation says

select subject,body from messages where subject matches ('apples','oranges')

should do a "one or more" search and return any messages containing either "apples" or "oranges". Instead, it only returns messages containing both.

 

To do a "one or more" search you must instead add quotes around the entire list like this

select subject,body from messages where subject matches "('apples','oranges')"

This was corrected in this thread API v2 Search doesn't work - Atlas (khoros.com) but the documentation was never updated.

 

BUG ONE

Can't include a phrase exact match in a combinatorial search as discussed here Combinatorial searches with LiQL (khoros.com)

Example, I have 4 posts with the following in the body.

  1. I just took down my christmas tree
  2. It's January and christmas is over
  3. I just cut down a tree
  4. Since it is christmas time I should get a tree

So, 1 has the exact phrase "christmas tree", 4 has both words "christmas" and "tree" but not together, 3 has just the word "tree" and 2 has just the word "christmas".

 

The query below only returns number 1 with the exact phrase "christmas tree" as expected.

SELECT subject, body FROM messages WHERE body MATCHES '"christmas tree"'

 

If I want to combine that with the one or more search based on the documentation and also the correction discussed above it should look like the below query. (Because of the double sets of double quotes, I had to escape the inner set)

SELECT id, subject FROM messages WHERE body MATCHES "('\"christmas tree\", bananas, cherries')"

This should also only return number 1, but it also returns number 4 which has both "christmas" and "tree" separately.  I have tried several variations on this, but none work the way expected. I can't find any way to return only number 1 (plus any messages with bananas or cherries).

 

BUG TWO

In a "one or more" search including a conjunction like "and" breaks the entire search.

For example, let's say this search returns 2 messages with "apples" in the subject.

SELECT id, subject FROM messages WHERE subject MATCHES "('apples', 'bananas')"

 

Adding the word "and" to the list breaks this and it returns zero results even though there should still be 2.

SELECT id, subject FROM messages WHERE subject MATCHES "('apples', 'bananas', 'and')"

 

I'm guessing the intention was to ignore conjunctions and similar words in the search which makes sense but instead it ignores all words in the search.

I stumbled upon a couple of other words with the same effect. The words "test" and "link" also break the search.

 

I will open a support case about the above bugs, but wanted to share and see if anyone sees anything I'm missing or has a work around especially for bug one. I guess I should take a look at API V1 and see if I can use that to get the results I am looking for.

  • RyanPi's avatar
    RyanPi
    Khoros Staff

    Hello there!

    Thank you so much for bringing these to our attention. While I personally can only speak to the documentation and not any bugs in LiQL, this part of our existing documentation is definitely due for an audit.

    I'll work with our documentation team to make sure these are updated and corrected. Your support case is greatly appreciated as it will enable engineering to prioritize resources to make sure any bugs are corrected.

    Thank you so much!