snipe-it icon indicating copy to clipboard operation
snipe-it copied to clipboard

Compound searches is not working in the 2.0.5 and develop branch

Open vabue opened this issue 11 years ago • 4 comments

In 2.0.4 there was ability to search on different columns simultaneously.

Search in 2.0.4

Here we search "POE" as a part of asset name and "Неті" as a part of location. Such search helps us to determine all POE devices in a distinct location.

vabue avatar Nov 24 '15 10:11 vabue

This appears to be broken on the current demo site as well. Works fine on my production install (v2.0-175).

dc53000 avatar Nov 24 '15 13:11 dc53000

This isn't broken, per se - it's a byproduct of switching to the new table system. All of the queries are done on the server now, instead of on the client end.

snipe avatar Nov 24 '15 17:11 snipe

Still broken in v2.1.0-8. When you search for something like part of model-name (SPACE) part of location the whole string is processed.

This is the resulting query:

select assets.* from assets inner join models on assets.model_id = models.id where assets.deleted_at is null and physical = '1' and ((select count() from models where assets.model_id = models.id and (select count() from categories where models.category_id = categories.id and (categories.name LIKE '%p920 ny%' or models.name LIKE '%p920 ny%') and categories.deleted_at is null) >= 1) >= 1 or ((select count() from status_labels where assets.status_id = status_labels.id and status_labels.name LIKE '%p920 ny%' and status_labels.deleted_at is null) >= 1) or ((select count() from companies where assets.company_id = companies.id and companies.name LIKE '%p920 ny%') >= 1) or ((select count() from locations where assets.rtd_location_id = locations.id and locations.name LIKE '%p920 ny%' and locations.deleted_at is null) >= 1) or ((select count() from users where assets.assigned_to = users.id and (users.first_name LIKE '%p920 ny%' or users.last_name LIKE '%p920 ny%' or ((select count(*) from locations where users.location_id = locations.id and locations.name LIKE '%p920 ny%') >= 1))) >= 1) or assets.name LIKE '%p920 ny%' or asset_tag LIKE '%p920 ny%' or serial LIKE '%p920 ny%' or order_number LIKE '%p920 ny%' or notes LIKE '%p920 ny' or _snipeit_mac_address LIKE '%p920 ny%' or _snipeit_ip_adresse LIKE '%p920 ny%' or _snipeit_lan_port LIKE '%p920 ny%' or _snipeit_raum LIKE '%p920 ny%') order by models.name asc limit 50 offset 00μslgln_snipeit Params 0 1 1 %p920 ny% 2 %p920 ny% 3 %p920 ny% 4 %p920 ny% 5 %p920 ny% 6 %p920 ny% 7 %p920 ny% 8 %p920 ny% 9 %p920 ny% 10 %p920 ny% 11 %p920 ny% 12 %p920 ny% 13 %p920 ny 14 %p920 ny% 15 %p920 ny% 16 %p920 ny% 17 %p920 ny% hints Use SELECT * only if you need all columns from table

OR is also not working as expected :'(

diekmanu avatar Feb 02 '16 07:02 diekmanu

Again, it wasn't really broken in the first place. We're adding in more sophistication to the search as we go, however this was never a bug.

snipe avatar Feb 02 '16 08:02 snipe