incubator-answer icon indicating copy to clipboard operation
incubator-answer copied to clipboard

Bug Report: MeiliSearch Plugin Not Updating New Answers

Open hbsciw opened this issue 1 year ago • 1 comments

Bug Report: MeiliSearch Plugin Not Updating New Answers

Description

I am experiencing an issue where new answers are not updating in MeiliSearch when using the MeiliSearch plugin.

Steps to Reproduce

  1. Update the answers in the system.
  2. Observe the behavior in MeiliSearch.

Expected Behavior

New answers should be updated in MeiliSearch.

Actual Behavior

New answers are not being updated in MeiliSearch.

Debugging Information

While debugging, I encountered an error message stating "a pointer to a pointer is not allowed" at line 417 in answer_repo.go. Here is a screenshot of the error:

Error screenshot

I suspect the issue might be related to the question instance initialization. As a workaround, I modified the initialization of the question instance, which seemed to resolve the issue temporarily. Here's the screenshot post-modification:

Workaround screenshot

Question

Is this a known bug? Can anyone confirm if the issue is indeed related to the initialization of the question instance?

Any guidance or confirmation on this issue would be greatly appreciated.

hbsciw avatar Jan 22 '24 10:01 hbsciw

@hbsciw Thanks for your feedback, you'r right.

You can commit your change to fixed this bug.

// original code

var (
    question *entity.Question
)
exist, err = ar.data.DB.Context(ctx).Where("id = ?", answer.QuestionID).Get(&question)

Can be modified according to your code.

var (
    question = new(entity.Question)
)
exist, err = ar.data.DB.Context(ctx).Where("id = ?", answer.QuestionID).Get(&question)

or change like this:

var (
    question *entity.Question
)
exist, err = ar.data.DB.Context(ctx).Where("id = ?", answer.QuestionID).Get(question)

kumfo avatar Jan 23 '24 02:01 kumfo