oplik0/nodebb-plugin-meilisearch

Topic search returns no results

Closed this issue · 3 comments

afrozl commented

Enabling topic search and running any query returns no hits. There are no errors in the client or on the server, just no results. Any suggestions on where to look?

If I search for the term 'german' in the topic 15199, I can see that the plugin searches for the following

german,
{
  attributesToRetrieve: [ 'postid' ],
  limit: 500,
  filter: [ 'tid = 15199' ],
  sort: undefined
}  

However, no results are returned.

{
  hits: [
    {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
    {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
    {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
    {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
    {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
    {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
    {}, {}, {}, {}
  ],
  query: ' german',
  processingTimeMs: 44,
  limit: 500,
  offset: 0,
  estimatedTotalHits: 76
}
afrozl commented

It does seem to find the posts, however the pids are missing, hence no results

{
  attributesToRetrieve: [ 'postid' ],
  limit: 500,
  filter: [ 'tid = 15199' ],
  sort: undefined
}  afghan
{
  hits: [
    {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
    {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
    {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
    {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
    {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
    {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
    {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
    {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
    {}, {}, {}, {},
    ... 355 more items
  ],
  query: ' afghan',
  processingTimeMs: 461,
  limit: 500,
  offset: 0,
  estimatedTotalHits: 455
}
afrozl commented

I can get it to work by changing this line

const id = `${data?.index?.length ? data?.index[0] : 'post'}id`;

to

const id = 'pid'
oplik0 commented

Thanks for reporting - 0.7.0 should have this fixed properly (your fix breaks the "show results as topic" option, since it wants tid instead)