Project

General

Profile

Actions

Bug #2604

closed

searching for hosts with digits can lead to unexpected results

Added by David Schmitt almost 11 years ago. Updated almost 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Search
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

repro

  • In a foreman containing current reports, search for "foobar$i", where $i is the current day of month. For example, today is the 3rd of june, so search for "foobar03".

expected results

  • All hosts matching "foobar03" are displayed as result.

actual results

  • All hosts matching "foobar03" and all hosts with a last_report date of 2013/06/03 are displayed (which is, like, 99% of them)

remarks

Many of our hostnames follow the common /$prefix\d\d/ pattern. When searching for fooblah03, and it is currently the 3rd of the month, this will lead to almost all hosts being returned in the search, making the search results pretty unusable.

This can be seen easily when looking at the generated SQL:

[...] WHERE (("hosts"."name" ILIKE '%foobar03%' OR ("hosts"."last_report" >= '2013-06-03 00:00:00' AND "hosts"."last_report" < '2013-06-04 00:00:00') OR "hosts"."ip" ILIKE '%foobar03%' [...]

I guess the searcher should avoid trying to match words with non-numeric parts against dates.

Actions

Also available in: Atom PDF