Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Search and Candy

I have been struggling with search while candy is on.

I know that in August you fixed the bug (different number of columns) while search.

I believe this is a problem again.

Search now reports, on return that there are different number of columns in 3 tables used by candy.
Here is the start of the error message

"The used SELECT statements have a different number of columns"

When I look more closely into the error message, it appears that the mismatch is between the number of columns in vanilla tables
GDN_Discussion and GDN_Comment on one end and candy tables GDN_Section, GDN_Page and GDN_Chunk.

If needed, I can reproduce the entire error message.

Sorry to bring this up again but the search code is much too complex for me to try to fix this.

However, if you give me specific instructions on what to do, I'll be more than happy to do it myself.

Apart from this small issue, candy is a great app!

Thanks,

Zvonko

Comments

  • SS ✭✭
    edited January 2013

    Sorry, but I did not found the problem. Please, provide screenshot (error stack trace).
    All works for me.
    I uploaded last version (from github) to Vanilla addons page.

  • No problem,
    I am adding a screen shot of the error message. If I post it as code it comes out looking as crap.

    I did the count of search fields and it is not the same.

    I am using vanilla 2.0.8.14

    Thanks for taking time to look into it.

  • I can repair that crap for you

    Do you have any other plugins active? I can't count those columns from the screenshot, but I believe you when you say the column counts are not the same. That's what the error message says too :-)

    There was an error rendering this rich post.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    @UnderDog said: I can repair that crap for you

    Lol Lol lol and awesome !

  • zhlousekzhlousek New
    edited January 2013

    OK, I'll take your offer. Thanks.
    Here is a breakdown (the best I can figure out to make it readable) of the error message (query that fails). Count the number of "as" which I believe constructs columns.

    I hope the code I pose comes out readable. - It didn't so I had to edit the post.

    Beginning of the Error message:

    The used SELECT statements have a different number of columns
    |Gdn_Database|Query|

    There are 5 select statements

    select * from (

    --------- Dashes inserted to make the code readable - I think there are 9 columns constructed ------

    select 
        match(d.Name, d.Body) against(:Search0) as `Relavence`, 
        d.DiscussionID as `PrimaryID`, 
        d.Name as `Title`, 
        d.Body as `Summary`, 
        d.Format as `Format`, 
        d.CategoryID as `CategoryID`, 
        concat('/discussion/', d.DiscussionID) as `Url`, 
        d.DateInserted as `DateInserted`, 
        d.InsertUserID as `UserID` 
            from GDN_Discussion d 
                where d.CategoryID in (-1, 1, 76) 
                and match(d.Name, d.Body) against (:Search1) 
                union all 
    

    --------- Dashes inserted to make the code readable - I think there are 9 columns constructed ------

    select 
        match(c.Body) against(:Search2) as `Relavence`, 
        c.CommentID as `PrimaryID`, 
        d.Name as `Title`, 
        c.Body as `Summary`, 
        c.Format as `Format`, 
        d.CategoryID as `CategoryID`, 
        concat('/discussion/comment/', c.CommentID, '/#Comment_', c.CommentID) as `Url`, 
        c.DateInserted as `DateInserted`, 
        c.InsertUserID as `UserID` 
            from GDN_Comment c 
            join GDN_Discussion d on d.DiscussionID = c.DiscussionID 
                where d.CategoryID in ('-1', '1', '76') 
                and match(c.Body) against (:Search3) 
                union all 
    

    --------- Dashes inserted to make the code readable - I think there are 10 columns constructed ------

    select 
        match(s.Name) against(:Search4) as `Relavence`, 
        s.SectionID as `PrimaryID`, 
        s.Name as `Title`, 
        Null as `Summary`, 
        "Text" as `Format`, 
        Null as `CategoryID`, 
        coalesce(s.Url, s.URI, s.RequestUri) as `Url`, 
        Now() as `DateInserted`, 
        0 as `UserID`, 
        'Section' as `RecordType` 
            from GDN_Section s 
            where match(s.Name) against (:Search5) 
            union all 
    

    --------- Dashes inserted to make the code readable - I think there are 10 columns constructed ------

    select 
        match(Title, Body) against(:Search6) as `Relavence`, 
        PageID as `PrimaryID`, 
        Title, 
        Body as `Summary`, 
        Format, 
        Null as `CategoryID`, 
        concat('/content/page/', PageID) as `Url`, 
        DateInserted, 
        0 as `UserID`, 
        'Page' as `RecordType` 
            from GDN_Page Page 
            where match(Title, Body) against (:Search7) 
            union all 
    

    --------- Dashes inserted to make the code readable - I think there are 9 columns constructed ------

    select 
        match(Name, Body) against(:Search8) as `Relavence`, 
        ChunkID as `PrimaryID`, 
        Name as `Title`, 
        Body as `Summary`, 
        "xHtml" as `Format`, 
        Null as `CategoryID`, 
        Url, 
        DateInserted, 0 as `UserID`, 
        'Chunk' as `RecordType` 
            from GDN_Chunk Chunk 
            where match(Name, Body) against (:Search9) ) s 
    

    --------------- The end part of the query ---------
    order by s.DateInserted desc
    limit 20`

  • SS ✭✭

    There are 10 columns from "GDN_Chunk query part".
    1. Relavence
    2. PrimaryID
    3. Title
    4. Summary
    5. Format
    6. CategoryID
    7. Url
    8. DateInserted
    9. UserID
    10. RecordType

    Extra column is "RecordType" goes from Candy application.

    In vanilla new column was added on 02.04.2012 https://github.com/vanillaforums/Garden/commit/1b20547dec07332dbe6114eeb5ec901c86654f9d.

    Looks like this commit is not from master branch.

  • SS ✭✭

    Update: No, it does.

  • Hello S,

    Thank you on our answer.
    I am using 2.0.8.14 downloaded from the site - not the github version.

    I'd appreciate if you could point me to the specific release you mention that does no have a search issue.

    Thanks

    Zhlousek

    @S said:
    There are 10 columns from "GDN_Chunk query part".
    1. Relavence
    2. PrimaryID
    3. Title
    4. Summary
    5. Format
    6. CategoryID
    7. Url
    8. DateInserted
    9. UserID
    10. RecordType

    Extra column is "RecordType" goes from Candy application.

    In vanilla new column was added on 02.04.2012 https://github.com/vanillaforums/Garden/commit/1b20547dec07332dbe6114eeb5ec901c86654f9d.

    Looks like this commit is not from master branch.

Sign In or Register to comment.