Closed pixeldj closed 1 year ago
Please do a fresh pull and see if this resolves your issue
Updated to latest commit (59c0b63) and I'm still having the issue. If I enter text into an advanced search field I get no results. If I refresh the page afterwards, the text from the advanced search goes into the regular search box and it shows some results, but it doesn't search within a specific column.
Here it's not working either. This is what happens when searching for models/categories:
Next exception 'Illuminate\Database\QueryException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'assets.model' in 'where clause' (SQL: select count() as aggregate from assets
inner join status_labels
as status_alias
on status_alias
.id
= assets
.status_id
and status_alias
.archived
= 0 where ((exists (select from models
where assets
.model_id
= models
.id
and models
.name
LIKE %P700%)) or assets
.model
LIKE %P700%) and assets
.deleted_at
is null)' in D:\SYSTEM\WPN-XM\www\snipe-it_v4\vendor\laravel\framework\src\Illuminate\Database\Connection.php:647
Next exception 'Illuminate\Database\QueryException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'assets.category' in 'where clause' (SQL: select count() as aggregate from assets
inner join status_labels
as status_alias
on status_alias
.id
= assets
.status_id
and status_alias
.archived
= 0 where (exists (select from models
where assets
.model_id
= models
.id
and exists (select * from categories
where models
.category_id
= categories
.id
and (categories
.name
LIKE %Monitors% or models
.name
LIKE %Monitors% or models
.model_number
LIKE %Monitors%) and categories
.deleted_at
is null)) or assets
.category
LIKE %Monitors%) and assets
.deleted_at
is null)' in D:\SYSTEM\WPN-XM\www\snipe-it_v4\vendor\laravel\framework\src\Illuminate\Database\Connection.php:647
Custom field search results in "No matching records found". But no exception/error message is logged here.
Can you inspect the API call via browser network and tell me what the URL (with params) is that it's trying to fetch from the API? (I don't need the domain name, just need the params to reproduce it locally.)
Also the advanced search is listed as experimental, so some issues are to be expected. We'll try to resolve them as quickly as we can.
Model:
GET /api/v1/hardware?status=&order_number=&company_id=&status_id=&search=P910&order=asc&limit=200&offset=0&filter=%7B%22model%22%3A%22P910%22%7D HTTP/1.1
Category:
GET /api/v1/hardware?status=&order_number=&company_id=&status_id=&search=Monitors&order=asc&limit=200&offset=0&filter=%7B%22category%22%3A%22Monitors%22%7D HTTP/1.1
Combined search: GET /api/v1/hardware?status=&order_number=&company_id=&status_id=&search=P910&order=asc&limit=200&offset=0&filter=%7B%22category%22%3A%22Monitors%22%2C%22model%22%3A%22P910%22%7D HTTP/1.1
Response code HTTP/1.1 500 Internal Server Error Server: nginx
/api/v1/hardware?status=&order_number=&company_id=&status_id=&search=32&sort=name&order=asc&limit=200&offset=0&filter=%7B%22custom_fields._snipeit_ram_gb_3%22%3A%2232%22%7D
It looks like it's actually returning rows, though. They just are not showing up on the page.
Can confirm this. I'm on Version v4.0.15 build 384 (g4f80eac)
Can you try the latest off of master?
Hi there - We haven't heard back in a bit, so I'm going to close this ticket for now, but will re-open it if you're still having issues.
Can confirm that the latest version fixed it. 🥇
Develop?
@diekmanu ?
Is it fixed in the develop branch? Because it's not working for me in v4.1.3
@diekmanu it's fixed on master and develop. Please give us the latest from your app log.
Next exception 'Illuminate\Database\QueryException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'assets.location' in 'where clause' (SQL: select count(*) as aggregate from assets inner join status_labels as status_alias on status_alias.id = assets.status_id and status_alias.archived = 0 where (exists (select * from locations where assets.location_id = locations.id and locations.name LIKE %City% and locations.deleted_at is null) or assets.location LIKE %City%) and assets.deleted_at is null)' in D:\SYSTEM\WPN-XM\www\snipe-it_v4\vendor\laravel\framework\src\Illuminate\Database\Connection.php:647
So for me everything location based + custom_field searches are not working.
I can't reproduce that at all. :( This line should have fixed it.
It seems that I was still using the master version from Nov 4th. Git on Windows is just crap... I guess I will just copy/paste the zip archives once again. Is the aws-sdk required now? Migration fails for me, without the dev packages.
I removed the AWS SDK from composer. We don't use it anywhere. (The hope was to allow S3 uploads, but the way Laravel does it currently requires a symlink, and I just can't currently bear having to support users not knowing how to do that.)
Um...
D:\SYSTEM\WPN-XM\www\snipe-it_v4>php artisan migrate
Fatal error: Class 'Aws\Laravel\AwsServiceProvider' not found in D:\SYSTEM\WPN-X M\www\snipe-it_v4\config\aws.php on line 23
Call Stack: 0.0000 232856 1. {main}() D:\SYSTEM\WPN-XM\www\snipe-it_v4\artisan:0 0.0300 3971408 2. Illuminate\Foundation\Console\Kernel->handle() D:\SYS TEM\WPN-XM\www\snipe-it_v4\artisan:36 0.0300 3971536 3. Illuminate\Foundation\Console\Kernel->bootstrap() D:\ SYSTEM\WPN-XM\www\snipe-it_v4\vendor\laravel\framework\src\Illuminate\Foundation \Console\Kernel.php:114 0.0300 3971704 4. Illuminate\Foundation\Application->bootstrapWith() D: \SYSTEM\WPN-XM\www\snipe-it_v4\vendor\laravel\framework\src\Illuminate\Foundatio n\Console\Kernel.php:267 0.0400 4116552 5. Illuminate\Foundation\Bootstrap\LoadConfiguration->bo otstrap() D:\SYSTEM\WPN-XM\www\snipe-it_v4\vendor\laravel\framework\src\Illumina te\Foundation\Application.php:208 0.0400 4143992 6. Illuminate\Foundation\Bootstrap\LoadConfiguration->lo adConfigurationFiles() D:\SYSTEM\WPN-XM\www\snipe-it_v4\vendor\laravel\framework \src\Illuminate\Foundation\Bootstrap\LoadConfiguration.php:39 0.0490 4570912 7. require('D:\SYSTEM\WPN-XM\www\snipe-it_v4\config\aws. php') D:\SYSTEM\WPN-XM\www\snipe-it_v4\vendor\laravel\framework\src\Illuminate\F oundation\Bootstrap\LoadConfiguration.php:71
So I have to install it manually / put it in composer.json?
So I have to install it manually / put it in composer.json?
No. You must still have some leftover files or something. If you look on master, the aws.php config file doesn't even exist anymore.
Just deleted it and migration won't throw an error anymore. Perhaps I really should run this on a Linux machine in the future, where Git actually works 😄
Location search is working now. 👍 When I try to add custom fields the query result is still blank...but no error in laravel.log
Can you tell me what query it's trying to run using the debugbar?
GET /api/v1/hardware?status=&order_number=&company_id=&status_id=&search=DEL-R1&order=asc&limit=20&offset=0&filter=%7B%22name%22%3A%22display%40gll-del%22%2C%22custom_fields._snipeit_raum_6%22%3A%22DEL-R1%22%7D HTTP/1.1 Host: webservices:8103 Connection: keep-alive Accept: application/json, text/javascript, /; q=0.01 X-CSRF-TOKEN: jP1QrlQdy2OcWEgpanSs7v6WLxbmq7t7FYMhUCZj X-Requested-With: XMLHttpRequest User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36 Content-Type: application/json Referer: http://webservices:8103/hardware Accept-Encoding: gzip, deflate, sdch Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4 Cookie: assetTable-gb6a14d2.bs.table.searchText=; laravel_token=eyJpdiI6IlVcL2ZoOUtxNjVcL2JlRjgrYWtaM3Judz09IiwidmFsdWUiOiJzekxGUGZvZkJxemVpXC9qbXlDQjhjRkUzN0V2eGRmVWE5cjV5b3d2SjZWdnFRcmdEdEorYlM1eDU2czFORFM1NFlPc0xISDJTUGE5bnEyUFNHNUl4bjNsaGI0UzV2TlF5RmtjNmRFdXhFZUxJVTlOelNsXC9SN3c0YnlodzZOaEVFcEowT0p6ZEJ4WmpaVnlnaksxUE5JQkFrSXhsV3E1dGowZHZFOWtLTFpNSDRseERzdnRJamlYWXc4ZjZtYjZHMzZtVlwvNU9aNlMreTBcL2Y5SE42S01WQjVsS01EZjlZMHZyVHpQOERpSFpPVUpHNHZUbzBaQ2Z6K3ZWQW1cL2gwdytkN2E3T2NCcjJqdklxeWxmYkl1N2V3PT0iLCJtYWMiOiIzZWZlNzAxZmMzZDU3ZDVlNDFmM2Y1OGVlYWE0Y2M1MWZmNTBmYjgxOWIzYTFiOTY2YTc0MjFjOWIzZDIwNTFhIn0%3D; XSRF-TOKEN=eyJpdiI6InNRS2RmWTlcLzNMV1BWRUwzY1V4M0h3PT0iLCJ2YWx1ZSI6IkQ1M2l6UDBrdzFkeGptV1psb005T3VWazNoK3lJblAxRThPanI1TTh4enNhcjd4ZkhKbjZsYWlxNUZqSjRxenhjQzRIOTlwSmpEbzZNSFJ3bVoxVHNBPT0iLCJtYWMiOiIyNzMyZDY0MjhkMmM0ZWY5MThiMWQ4NDM3YWNhNmJjODBiYjllOTYzODBhOGIxOTVlMjViODAzZTEyZDYyZTQxIn0%3D; snipeit_session=jvv3U9yEsANbnbBtphqk4p5FPbypKXMqQz7p0inD; assetTable-g74aa562.bs.table.searchText=DEL-R1
So the custom field is called "Raum" with the value "DEL-R1"
Is this enough? Debugbar is just full of internal stuff. Paths, environment variables, etc. I would need to alter this first.
Custom field queries actually return the right rows, when looking at the developer tools. Just like in the example above. The results just don't show up.
Search by manufacturer generates an error: GET /api/v1/hardware?status=&order_number=&company_id=&status_id=&search=Fujitsu&order=asc&limit=20&offset=0&filter=%7B%22manufacturer%22%3A%22Fujitsu%22%7D HTTP/1.1 Host: webservices:8103 Connection: keep-alive Accept: application/json, text/javascript, /; q=0.01 X-CSRF-TOKEN: jP1QrlQdy2OcWEgpanSs7v6WLxbmq7t7FYMhUCZj X-Requested-With: XMLHttpRequest User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36 Content-Type: application/json Referer: http://webservices:8103/hardware Accept-Encoding: gzip, deflate, sdch Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4 Cookie: assetTable-gb6a14d2.bs.table.searchText=; assetTable-g74aa562.bs.table.columns=%5B%22checkbox%22%2C%22name%22%2C%22image%22%2C%22asset_tag%22%2C%22serial%22%2C%22model%22%2C%22category%22%2C%22status_label%22%2C%22assigned_to%22%2C%22location%22%2C%22manufacturer%22%2C%22purchase_cost%22%2C%22custom_fields._snipeit_mac_address_1%22%2C%22custom_fields._snipeit_ip_adresse_2%22%2C%22custom_fields._snipeit_lan_port_3%22%2C%22custom_fields._snipeit_raum_6%22%2C%22custom_fields._snipeit_dsm_rc_viewer_7%22%2C%22checkincheckout%22%2C%22actions%22%5D; DeployedassetTable-g74aa562.bs.table.columns=%5B%22checkbox%22%2C%22name%22%2C%22image%22%2C%22asset_tag%22%2C%22serial%22%2C%22model%22%2C%22category%22%2C%22status_label%22%2C%22assigned_to%22%2C%22location%22%2C%22manufacturer%22%2C%22purchase_cost%22%2C%22custom_fields._snipeit_mac_address_1%22%2C%22custom_fields._snipeit_ip_adresse_2%22%2C%22custom_fields._snipeit_lan_port_3%22%2C%22custom_fields._snipeit_raum_6%22%2C%22custom_fields._snipeit_dsm_rc_viewer_7%22%2C%22checkincheckout%22%2C%22actions%22%5D; laravel_token=eyJpdiI6IjZRejFLcmhUWG5cL0FWTkpDUmhLSHRBPT0iLCJ2YWx1ZSI6Im1ld3REd2dFaldKMXBHUVAxOEVZYkFrckFGMEduc05RS1o3YWRoeExtNDBnNzhzK3M3TDNSSklSN1M5Zjg4VmxseThGNEkyNmU2R0pCVklvTGhQNGZVN3JYdzVlOU51UXpWV1QwNHNlOHlVeVgxZmZJd281U0ZsbUUzdWxHSWtEd1lpR01Pc3B0a1Brc280WCs4WWhMRVJyTVMzWk90alhqXC9pamZLUEozZm1aeDU3cExYd2I0M0kzXC9paWFLQXRNSHYrSzk0ZnNpd1FcLzFRVURKMnRteVJIQmlpbzE3aGEwVGxNQW00dkdjZlZjSzVmcnU1RDFEOVd5RXpNNEJDNDBvWk5yaURMQUxFRENrWUJkUFF4dHdBPT0iLCJtYWMiOiIyMTkwMDE5YjE2ZmU2YmY0NDg3NjM2Y2E5YTYxODRhYWFkOWRiMWFiNWJhYTdmZmQwYTA2MjQ2MmZiN2E0NTQ3In0%3D; XSRF-TOKEN=eyJpdiI6InMxT3RQUk9iTVwvUU0wV0RTXC9UbG1Wdz09IiwidmFsdWUiOiJVUG8xRklwR0NnT1dNMm50NEZ6bGZaQTBaNWNcLzJOd3BQQ2F5ZmpPSDhTT0ZcLzdyc1V0MlV2VDB1TW91XC82XC8wTng0RVwvT1wvWWdaVzl6dXBsRE5POTFrQT09IiwibWFjIjoiMzM3OWU3MDU5NTkwZDEwOTJhMzU5MDM2ZmM1MTg0Mzk0N2ViMDI1MjYxY2M4MWRiMTEwNTIwYjc5NzljNmExZiJ9; snipeit_session=jvv3U9yEsANbnbBtphqk4p5FPbypKXMqQz7p0inD; assetTable-g74aa562.bs.table.searchText=Fujitsu
Whoops, looks like something went wrong.
HTTP/1.1 500 Internal Server Error Server: nginx Content-Type: text/html; charset=UTF-8 Transfer-Encoding: chunked Connection: keep-alive X-Powered-By: PHP/5.6.29 Cache-Control: no-cache, private date: Wed, 08 Nov 2017 15:42:06 GMT X-Content-Type-Options: nosniff Referrer-Policy: same-origin X-XSS-Protection: 1;mode=block X-Frame-Options: SAMEORIGIN Set-Cookie: snipeit_session=jvv3U9yEsANbnbBtphqk4p5FPbypKXMqQz7p0inD; expires=Thu, 16-Nov-2017 23:42:06 GMT; Max-Age=720000; path=/; httponly
I'm looking specifically for the asset related DB queries in the Query section of the debugbar.
(Also, if there's a whoops error, there's got to be something in the logs)
This is the exception I'm getting when searching for manufacturers:
Next exception 'Illuminate\Database\QueryException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'assets.manufacturer' in 'where clause' (SQL: select count() as aggregate from assets
inner join status_labels
as status_alias
on status_alias
.id
= assets
.status_id
and status_alias
.archived
= 0 where (exists (select from models
where assets
.model_id
= models
.id
and exists (select * from manufacturers
where models
.manufacturer_id
= manufacturers
.id
and (manufacturers
.name
LIKE %Fujitsu%) and manufacturers
.deleted_at
is null)) or assets
.manufacturer
LIKE %Fujitsu%) and assets
.deleted_at
is null)' in D:\SYSTEM\WPN-XM\www\snipe-it_v4\vendor\laravel\framework\src\Illuminate\Database\Connection.php:647
Okay, I can fix that. I know where to do it, but am AFK right now. Will have a fix out for you tomorrow.
Thanks again @snipe
I hope this is the right location in the debugbar log regarding the custom field issues:
"connection":"abcd_snipeit-v4"},
{"sql":"select count(*) as aggregate from assets
inner join status_labels
as status_alias
on status_alias
.id
= assets
.status_id
and status_alias
.archived
= '0' where (assets
.name
LIKE '%display@gll-del%' or assets
._snipeit_raum_6
LIKE '%DEL-R1%') and assets
.deleted_at
is null",
"type":"query",
"params":[],
"bindings":["0",
"%display@gll-del%",
"%DEL-R1%"],
"hints":[],
"backtrace":[{"index":13,
"namespace":null,
"name":"\app\Http\Controllers\Api\AssetsController.php",
"line":244},
{"index":14,
"namespace":null,
"name":"\app\Http\Controllers\Api\AssetsController.php",
"line":244},
{"index":34,
"namespace":null,
"name":"\app\Http\Middleware\CheckForDebug.php",
"line":25},
{"index":37,
"namespace":null,
"name":"\vendor\fideloper\proxy\src\TrustProxies.php",
"line":56},
{"index":40,
"namespace":null,
"name":"\app\Http\Middleware\CheckForSetup.php",
"line":27},
{"index":43,
"namespace":null,
"name":"\app\Http\Middleware\NosniffGuard.php",
"line":17},
{"index":46,
"namespace":null,
"name":"\app\Http\Middleware\ContentSecurityPolicyHeader.php",
"line":18},
{"index":49,
"namespace":null,
"name":"\app\Http\Middleware\ReferrerPolicyHeader.php",
"line":17},
{"index":52,
"namespace":null,
"name":"\app\Http\Middleware\XssProtectHeader.php",
"line":18},
{"index":55,
"namespace":null,
"name":"\app\Http\Middleware\FrameGuard.php",
"line":17},
{"index":70,
"namespace":null,
"name":"\public\index.php",
"line":59}],
"duration":0,
"duration_str":"0\u03bcs",
"stmt_id":"\app\Http\Controllers\Api\AssetsController.php:244",
Manufacturer issue should be sorted now
If you run that query on the db: "select count(*) as aggregate from assets inner join status_labels as status_alias on status_alias.id = assets.status_id and status_alias.archived = '0' where (assets.name LIKE '%display@gll-del%' or assets._snipeit_raum_6 LIKE '%DEL-R1%') and assets.deleted_at is null"
Do you get results? If it's not producing an error I'm not sure what to do here.
Still not working for me on the latest pull on Nov 9th (578da128e9e009fb658bc6a9d60054ea21e203e5)
The query seems to be okay. But still no results on v4.1.4 build 173 (gba38b84)
Manufacturer search works now 👍
What's the current status of this issue?
For me...everything works except custom field searches. Here the right results are only displayed in the developer tools (Chrome) . These are not showing up on the page.
For me, asset tag searches work in advanced search, but asset name, status, location, checked out user all return everything. Custom field searches in advanced search return nothing at all.
EDIT (4/9/18): It appears that regular fields work in advanced search now, but custom fields still return nothing.
For me , everything works except custom field searches. and also I upgrade to the v4.1.9-pre - build 3117(master), still get the same problem ~
I can confirm this with version v4.1.10-pre - build 3160 (master)
@migaspar what's in your error logs?
problem persists with Version v4.1.10 - build 3249 (master). there is no corresponding error in storage/logs/laravel.log. btw, the search in the general search window works as expected.
i have the same problem with 4.1.14 doesn't search in custom fields, php 7.0.25 Ubuntu 16.04.01 Laravel Version 5.4.35
debugger log.txt file
i had upgraded to 4.2 still custom filed have result from server but doesn't display on screen
Just tried on the live demo and it appears custom field searches still return no results.
I added IPv4 custom field to 13" Macbook Pro model, edited an asset and added the IP "10.0.0.10". When I use regular search it comes up, but when searching in the "IPv4" field with custom search, nothing is returned.
We're about to switch from a simple Excel sheet to SnipeIT now. We have v4.2.0 - build 3479 (master) running on premise. The only dealbreaker is the bug in the advanced search right now as Excel searches work so much better. Are there any quick fixes I could apply to make the search results appear?
I suppose the AJAX request is not done right. When I compare the console output of my Chrome, the standard and the advanced search are quite different (see attached pictures).
Standard filter:
Advanced filter:
I'm also experiencing issues with the advanced search. It appears to work for standard fields but whenever I search on a custom field no results appear.
v4.2.0 build 3497 (g590938f)
@uberbrady can you take a look at this? The file you want to eyeball is public/js/extensions/bootstrap-table-toolbar.js
. Custom field searching doesn't work, though the query that's generated is correct (in other words, this looks like a BS tables issue or the table toolbar issue.)
It also looks like the API is being hit twice when you use the advanced search, the first time erroring, the second time loading as expected. This happens whether you're searching on custom fields or not, but when you search on custom fields, the table loads no results, ever, whereas the advanced search on normal fields returns expected results.
We have a new premise-based installation and the advanced search features clearly do not work properly. Running version 4.20 build 3479.
If I filter the results in the "search" box, the results are consistent with my expectations (although it's quirky and sometimes i have to clear the box and reload the the full asset list). When i put that same criteria into the advanced search using non-custom fields, i get totally different results that are clearly wrong. A simple Location search ignores most assets in that location. All category searches return no records. Doing a combination of filters almost always yields no records. As it stands, the advanced search is not usable.
Unfortunately this is still an issue in 4.4.1 :-/
Expected Behavior (or desired behavior if a feature request)
Expecting results when using advanced search on assets page.
Actual Behavior
No results returned when using most searches, or in some cases search is not filtering properly.
Please confirm you have done the following before posting your bug report:
Provide answers to these questions:
Is this a fresh install or an upgrade? Fresh
Version of Snipe-IT you're running v4.0.13 build 273 (gab3f5f4)
Version of PHP you're running 7.0.22-0ubuntu0.16.04.1
Version of MySQL/MariaDB you're running 10.1.28-MariaDB
What OS and web server you're running Snipe-IT on Ubuntu 16.04.3/apache2
What method you used to install Snipe-IT (install.sh, manual installation, docker, etc) install.sh
WITH DEBUG TURNED ON, if you're getting an error in your browser, include that error
What specific Snipe-IT page you're on, and what specific element you're interacting with to trigger the error: /hardware
If a stacktrace is provided in the error, include that too.
Any errors that appear in your browser's error console.
Confirm whether the error is reproduceable on the demo: https://snipeitapp.com/demo. Yes
Include any additional information you can find in
app/storage/logs
and your webserver's logs. [2017-10-20 13:49:29] production.ERROR: PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'model' in 'where clause' in /var/www/snipeit/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:77Include what you've done so far in the installation, and if you got any error messages along the way. Installed fresh and imported database from same version.
Indicate whether or not you've manually edited any data directly in the database
Please do not post an issue without answering the related questions above. If you have opened a different issue and already answered these questions, answer them again, once for every ticket. It will be next to impossible for us to help you.
https://snipe-it.readme.io/docs/getting-help