Search dialogs
You have spent major hours taking/editing photos and cataloging data. Very possibly 1000’s of cans. Well what if you want to answer the simple question “How many cans were produced by the Heekin canning company”. An actual Rusty Bunch question of which damn, I have all that data cataloged but no easy way to find it!
There are now “Search Quick” and “Search Detailed” options.
Search Quick…
As the name implies, this is a “Quick” search. Simply type a pattern and all Items within the entire currently selected “Project” will be searched, and a match will occur if an Item has *any property* which *contains* that pattern. Type 1..N characters and hit <Enter>.
Of course there needs to be a way to view the searched result set. First iteration was to generate a static HTML file. Boring. Next iteration produced a very basic “web browser” type dialog, but at least interactive where user could click on any of the search images. However, CanDB 5.0 with the new CanViewer, I don’t know why anyone would use any option other than “Results within Viewer window”. I simply did not want to throw away the previous two possibilities.
Note: The special case value of “*” (asterisk) means to match anything, if your project is reasonable size and you want to view everything in one window/dialog.
With “Search Quick” you have no control over “which” properties are compared, however, when using the CanViewer for display of results, the following is added to the bottom button bar. This will display your search pattern of which you can easily refine/change for more searches.
Search Detailed…
As mentioned above, “Search Quick” provides no control over “which” properties are compared, and only if pattern is contained in a number of hardcoded possibilities. But what if I want to search for all cans containing the text “lucky” but not the pattern “draft” or “light”. Well, use the “Search Detailed” where you do have full control.
With the above I have chosen to match the property “ShortName” for all Items that “Starts With” the pattern “lucky”. I use the same property but choose to NOT select if it contains “draft” or “light”. Summary, with the above this is a detailed search of Item short name starting with “lucky” but do not contain “draft” or light”. Gives me exactly what I want.
Additional noted items
Note1: The default is to AND all criteria together. That is, criteria A and B and C must all match to include an Item. If you uncheck this option, the criteria turns into A or B or C, as long as one of them match to include an item. I did have a column with AND/OR in a combo box where user could search for A and B or C and D, but I would have needed to add “parens” to allow grouping. e.g. (A or B) and (C or D), as well ran into some complications with NOT, since “not foobar” will match everything. While I have written that type of logic parsing for other projects, way too complex for CanDB.
Note2: I don’t like the “weak” little check mark for a selected check box. Unfortunately this is mandated by the native platform, this case Windows 11. There may be a way to configure Windows to be a bolder selection, and I did look into a custom SWT painter to override, but simply too much code for so little value. Use reading glasses if necessary…
Note3: There is no documentation for the set of possible properties in the CanItemCan or CanItem tree on the left. This set is generated with Java Reflection looking for all getXXX() methods that take zero parameters and return String, and would have been time consuming and likely not complete to attempt to add Word documentation. Recommendation if unclear what a property means, just give it a try as a label in the CanViewer. Or, have the Item tab open and match up the “getter” name with one of the data entry widgets labelled with similar name. That said, here are a few:
Label Name |
Description |
FullReference |
Your assigned numbering of an item. For example, 60-124 |
ShortName |
Your assigned Short Name. This is likely too verbose for CanViewer display, but I expect this will be used frequently for Search |
ShortWord |
Just the first “word” of Short Name. Sometimes useful for CanViewer labels |
USBCx |
There are two references, USBC 1 (flats/cones) and USBC 2 (tabs). A given item may have none, one, or both assigned values. USBCx first looks for USBC 1, and then USBC 2 |
xxxConcise |
Labels such as CanCode and CanCompany are fine verbose when displayed on the Item tab, but often a bit too long for CanViewer display. The xxxConcise labels are an attempt to “squeeze” the same info into a shorter, concise string for CanViewer display. |
Matching criteria
The “Not” is hopefully explanatory, simply means “if a given property does NOT match” the specified pattern. As for the set of “Matches” possibilities:
Equals : An item’s property must match literal compare exactly. Recommendation rarely use this option.
Contains: Is the text pattern contained within the given property? Probably best to always use this option.
Starts With: An item’s property must start with the pattern text
Ends With: An item’s property much end with the pattern text
Empty: Limited use, but if I enabled with USBCx, this would match all Items with no USBC 1 or 2 entry.
RegExp: You want to find all items where property XYZ has 3rd letter [A-Z] and 6th letter a digit [0-9]? Go for it.
Note: All patterns are *case insensitive” except for RegExp. For all others, “lucky” and LuCkY” will match the same.
RegExp is short for “Regular Expression”, a feature that has been around since early programming days and available in most programming languages or text editors. These RegExp are specially formatted patterns that are “pre-compiled” and then complex “matcher” used to compare against a character string. Very powerful, but for non-programmers, a major learning curve. CanDB will at least try/catch around the pre-compile, and warn if you have a defect in your pattern.
As for RegExp possible patterns, Google for “java pattern” and prepare to do some reading. I am very proficient with these patterns after 35 years of programming, and when you get lost but have a specific search pattern you would like, please ask. I might just reply “good luck”, but likely I can drop you a quick reply “copy and paste” this pattern…