Cell Database Sorting

Korishan

Administrator
Joined
Jan 7, 2017
Messages
7,542
Curious, could it be possible on the Cell Database main thread/forum, could you have a drop down box that would list all the cells alphanumerical? Such that, you click the drop down, scroll through till you find your number, click the item, and it jumps you to that thread with the information.
Reason being, now that the database is several pages long, to find any specific number, you have to jump through a few pages to find it, even after sorting by Thread Name as a lot of cell names start the same.
 
Filtering options would be nice too, like you type in icr26d and you'd see the icr18650-26d cell on the page w\o reload (ajax/javascript coding similar to how google does their instant searches). First/Last segment searching could be enabled for short strings say 8 character or less due to the brute force nature (8 values to check in the db, 1 query though).

Assuming some of the datasheet specs are stored in the table instead of just in the raw posts, it would be nice to be able to add/remove columns such as mah ratings or discharge current.

Both of these and the OP's suggestion should be pretty easy to code up on the existing page. My ajax/javascript is weak, but good with php and have done big data work in mysql (managed/optimized a 1.04tb mysql database for ~ 100ms searches across 16 table sets if I remember correctly.)
 
WallBender: yeah, kinda like the way google updates searches when you type. However, I think this would be a bit more difficult to do
 
If you mean the start/end search (to skip typing common numbers on cells) it's pretty simple but might require an extra field on the table which if it's running on mysql and is new enough, it could be a virtural field based on the model of the cells. All spaces dashes and such should be removed and the same for user input to make it easier to match which is purely back end based. Here's a quick example what php would have to do in basic steps.

Filter user input for security (sql injections etc)
remove unwanted characters (could be done in the javascript section and be assumed it's done in php)
if input is <= 8 split string at every posistion and store in an array, else just push the input into the array
Example of what I mean by splitting, if the input was "abcd" it would split like this with the format start/end and the next step would have to have a case for no ending search.

"abcd",""
"abc","d"
"ab","cd"
"a","bcd"
"","abcd"

Build sql statement for start/end search (store the model number in reversed in an indexed column with the "cleaned" model number ex index(model_clean, model_reversed) depending on the sql statement it probably isn't optimized but it's just an example.
process/output results

For a basic example on the sql, something like this could work (ignoring other fields in the example though and not really optimized).

SELECT * FROM cell_data_table WHERE
model_clean LIKE "abcd%" OR
model_clean LIKE "abc%" AND model_reversed LIKE "d%" OR
model_clean LIKE "ab%" AND model_reversed LIKE "dc%" OR
model_clean LIKE "a%" AND model_reversed LIKE "dcb%" OR
model_reversed LIKE "dcba%";

This example would give results for models like this:

abcd18650xyz
ab18650dc
18650abcd

If this doesn't come about I'll probably scrape the cell db for the info and build a personal one that supports it if I end up getting a ton of cells. I only have around 200 atm as a test batch.
 
Back
Top