Skip to content

Commit

Permalink
fix(idea/squid): case insensetive queries (#1620)
Browse files Browse the repository at this point in the history
  • Loading branch information
osipov-mit authored Aug 16, 2024
1 parent d41e35c commit 5a8b85b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion idea/explorer/src/services/code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class CodeService {
}

if (query) {
qb.andWhere('(code.id ILIKE :query OR code.name ILIKE :query)', { query: `%${query}%` });
qb.andWhere('(code.id ILIKE :query OR code.name ILIKE :query)', { query: `%${query.toLowerCase()}%` });
}

qb.orderBy('code.timestamp', 'DESC').limit(limit).offset(offset);
Expand Down
4 changes: 2 additions & 2 deletions idea/explorer/src/services/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ export class EventService {
}

if (service) {
builder.andWhere('event.service = :service', { service: service.toLowerCase() });
builder.andWhere('event.service ILIKE :service', { service: `%${service.toLowerCase()}%` });
}

if (name) {
builder.andWhere('event.name = :name', { name: name.toLowerCase() });
builder.andWhere('event.name ILIKE :name', { name: `%${name.toLowerCase()}%` });
}

builder.orderBy('event.timestamp', 'DESC').take(limit).skip(offset);
Expand Down
8 changes: 4 additions & 4 deletions idea/explorer/src/services/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ export class MessageService {
}

if (service) {
qb.andWhere('msg.service = :service', { service: service.toLowerCase() });
qb.andWhere('msg.service ILIKE :service', { service: `%${service.toLowerCase()}%` });
}

if (fn) {
qb.andWhere('msg.fn = :fn', { fn: fn.toLowerCase() });
qb.andWhere('msg.fn ILIKE :fn', { fn: `%${fn.toLowerCase()}%` });
}

qb.orderBy('msg.timestamp', 'DESC').limit(limit).offset(offset);
Expand Down Expand Up @@ -110,11 +110,11 @@ export class MessageService {
}

if (service) {
qb.andWhere('msg.service = :service', { service: service.toLowerCase() });
qb.andWhere('msg.service ILIKE :service', { service: `%${service.toLowerCase()}%` });
}

if (fn) {
qb.andWhere('msg.fn = :fn', { fn: fn.toLowerCase() });
qb.andWhere('msg.fn ILIKE :fn', { fn: `%${fn.toLowerCase()}%` });
}

qb.orderBy('msg.timestamp', 'DESC').limit(limit).offset(offset);
Expand Down
2 changes: 1 addition & 1 deletion idea/explorer/src/services/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class ProgramService {
}

if (query) {
qb.andWhere('(program.id ILIKE :query OR program.name ILIKE :query)', { query: `%${query}%` });
qb.andWhere('(program.id ILIKE :query OR program.name ILIKE :query)', { query: `%${query.toLowerCase()}%` });
}

qb.orderBy('program.timestamp', 'DESC').limit(limit).offset(offset);
Expand Down

0 comments on commit 5a8b85b

Please sign in to comment.