question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Do not apply filter to query

See original GitHub issue

I have executed all commands on readme page to run on Adonis 5. Using this code :

  public async index({ request, response, logger }: HttpContextContract) {
    const { page = 1, perPage = 10, ...input } = request.qs()
    console.log(input)
    const partners = Partner.filter(input).paginate(page, perPage)
    logger.info({ Page: page, PerPage: perPage }, 'Partners search success')
    return response.ok(partners)
 }

This is the output log :

{ name: ‘Claudio’ } <<-- input [1642161988635] INFO (pv-backend/17956 on ASUS): Partners search success Page: 1 PerPage: 10

As you can see, the debugging query logger do not contain any where statement “sqlite” Partner (3.7 ms) SELECT COUNT(*) AS total FROM partners [] “sqlite” Partner (2 ms) SELECT * FROM partners LIMIT ? [ 10 ]

Obviously, a partner with name Claudio exist on db, but any rows was not returned.

I’m missing any things ?

Thank’s

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
clabnetcommented, Jan 14, 2022

Ok @LookinGit , thanks It working. I’m a stupid. I have linked a wrong filter file., the row wrong was

import PartnerFilter from 'App/Models/Filters/UserFilter'
0reactions
clabnetcommented, Jan 14, 2022

// PartnerModel.ts

import { column, BaseModel, HasMany, hasMany, belongsTo, BelongsTo } from '@ioc:Adonis/Lucid/Orm'
import { DateTime } from 'luxon'
import Customer from './Customer'
import User from './User'

import PartnerFilter from 'App/Models/Filters/UserFilter'
import { compose } from '@ioc:Adonis/Core/Helpers'
import { Filterable } from '@ioc:Adonis/Addons/LucidFilter'

export default class Partner extends compose(BaseModel, Filterable) {
  public static $filter = () => PartnerFilter

  @column({ isPrimary: true })
  public id: number

  @column()
  public name: string

  @column()
  public email: string

Read more comments on GitHub >

github_iconTop Results From Across the Web

Filter data (Power Query) - Microsoft Support
In Power Query, you can include or exclude rows according to a specific value. A filtered column contains a small filter icon in...
Read more >
Solved: Basic filter in power query editor is not filterin...
Hello! I have a problem with the power query editor when I try to filter any column in any way. The rows will...
Read more >
Warning! Misleading Power Query Filtering - RADACAD
In this post I'll show you through a very simple example how misleading it can be and what it the correct way to...
Read more >
Should I apply filters at the report or dashboard level?
Unfortunately i have experienced the filter in the query doesn't limit the data can be view from the same query in the dashboard....
Read more >
How Query Filters Work
Filters you apply to the query definition are called query filters. You use query filters to reduce the amount of data retrieved from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found