Skip to content

Predefined search

Znerox edited this page Jul 2, 2018 · 8 revisions

What is predefined search?

"Predefined search" is a way to pregenerate searches (as complicated as you want really), and have it easily accessible by a dropdown list. This is useful, to group together networks that have something common between them. You can for example show networks belonging to a specific ISP. Or networks with different SSID and vendor, that all acts as cellular hotspots.

Setting up your own predefined search

In the database, there is a field called "predefined_search" in the "network" table. When selecting a predefined search, you simply get all networks with this tag in the field. To make a predefined search, you need to run queries against the database, that defines the group of network that you want to tie to a selection in the dropdown menu. Note that you should run the various tools, including "Lookup MAC address for routers", prior to this.

Example 1, networks that match the SSID "MyCompany-Hotspot", and vendor "ZYXEL COMMUNICATIONS CORPORATION"

UPDATE network SET predefined_search='example_1' WHERE ssid LIKE 'MyCompany-Hotspot' AND vendor LIKE 'ZYXEL COMMUNICATIONS CORPORATION';

Example 2, networks from a specific ISP. This looks for an SSID consisting of a set string, then 4 digits, then 3 lower case letters (and its 5GHz counterpart). The MAC of the router must also be registered to Netgear.

UPDATE network SET predefined_search='example_2' WHERE (ssid REGEXP '^SomeISP[0-9][0-9][0-9][0-9][a-z][a-z][a-z]$' OR ssid REGEXP '^SomeISP[0-9][0-9][0-9][0-9][a-z][a-z][a-z]-5GHz$') AND vendor LIKE 'NETGEAR';

Regular expressions are very useful when selecting networks with SSID following a set pattern.

When the networks in the databse have been tagged with their "predefined search", all you need to do is add each search to the dropdown menu. Do this by editing wifimap\index.html Add below line 120

<option value="example_1">MyCompany Hotspot</option><option value="example_2">Some ISP</option>