using magma for autocompletion
Chris Muller
asqueaker at gmail.com
Tue Nov 10 16:35:04 UTC 2009
Excellent points made by Miguel. However, if you still want to forge
ahead with an auto-completion..
>> First, if I put the query in a separate smalltalk process and then kill
>> it before it completes (e.g., because there are new characters), can
>> this cause any harm?
A better approach would be to simply reset a 3-second Delay timer
every time a key is pressed. After the timer, do the uninterruptible
look-up. No need to kill any processes..
I never "kill" any Smalltalk Process, whether for Magma or any other
package. Killing a running process can leave things in an unclean
state. I prefer to only let them unwind gracefully by setting a
"doNotContinue" flag that is checked by the code.
>> Second, the typical scenario would be that one additional character is
>> typed. What's the most efficient way to handle this using magma
>> indices? I could simply give a new query, or I could query the results
>> of my previous query.
I think you should do some testing and benching, paying attention to
your pageSize and readStrategy, which can make the difference between
a sub-second vs. 10-second response.
>> Third, I could use special search structures (e.g., TSTree from the
>> BTree package) oriented to this problem. Would that be a good idea?
>> Should I persist those search trees?
No, I don't think these are going to outperform an indexed
MagmaCollection for this purpose, plus maintaining them as Miguel
said..
If you have multiple keywords, you may use the KeywordIndex..
- Chris
More information about the Magma
mailing list