[TYPO3-irre] Perfomance and usability issue
Oliver Hader
oh at inpublica.de
Mon Mar 26 17:46:26 CEST 2007
Hi Dave,
David Bruehlmeier wrote:
>> The difficulties for a sugguest approach could be the fact, that it has
>> to be defined, which field or label is used for searching and
>> visualizing the subset of results. Imagine the label is generated
>> individually by a "label_userFunc" - this would probably influence
>> performance in a negative way if 10,000 records have to be fetched and
>> the label to be rendered for each record and after that the search term
>> would be applied.
>
> Agreed. But this should be a solvable problem. Without further
> configuration, the "suggest" field type would only search the field
> marked as "label". Optionally, a list of fields might be marked as
> relevant search fields. And if label_userFunc is used, there should also
> be a suggest_userFunc option, so it would be up to the extension how to
> handle this (e.g. by building a redundant search words table).
Okay, so we focus on normal table fields first. The suggest_userFunc
will be optional and integrated later. For the suggest_userFunc an
indexed_search-like functionality could be nice for the back-end.
A definition in TCA could look like the following:
$TCA['tx_myext_parties']['columns']['addresses']['config'] => array(
'type' => 'select',
'foreign_table' => 'tx_myext_addresses',
'suggest' => true,
);
$TCA['tx_myext_addresses']['ctrl'] = array(
'label' => 'lastname',
'label_userFunc' => ...,
'suggest' => 'lastname, firstname, city',
// possibly this field should be called '*suggest_fields*'??
);
Furthermore we have to define, where this suggestion field makes sense
(in context of select and group/db).
>> I guess you're talking about an advanced search form? This could also be
>> used as new widget for e.g. the list module to search for records. And
>> if it is implemented well, it could be integrated into TCEforms
>
> Not sure what you mean by "advance search form". Is there some talk you
> can point me to?
Maybe I got this wrong. Could you please create a quick demo-screenshot
to get an impression how this could look like?
>> As already mentioned: +1 on the idea
>
> OK, cool! What would be your suggestion to carry this further? I would
> love to help implement this, but unfortunately, I have zero Ajax
> experience. Would it be possible for you to kick me off with a
> quick-and-dirty prototype, perhaps as a small extension? I would then
> try to take if from there and to bring it to a point where I can provide
> a patch for the core.
Okay, I can imagine a general suggest-function for back-end and
front-end (somewhere in t3lib). So, you tell this function from which
table (or tables) to fetch data, the search expression and the fields
that are interesting, e.g.
// Define to search in which tables and in which fields there:
$tableFieldArray = array(
'tx_myext_addresses' => array('name', 'city', 'zip'),
'tx_myext_companies' => array('managername', 'employees'),
);
// A sample search term:
$searchTerm = 'John';
// Define a HTML string the matches should be wrapped with:
$wrapMatchesWith = '<span class="found">|</span>';
// Get the suggestions:
$result = t3lib_TCEforms::renderSuggestField(
$tableFieldArray, $searchTerm, $wrapMatchesWith
);
I found a page describing a way of using suggest using prototype:
http://www.ajaxon.com/michael/?p=8
http://www.ajaxon.com/michael/?p=10
script.aculo.us has "autocomplete" fields, maybe this could be better?
http://wiki.script.aculo.us/scriptaculous/show/Demos
http://demo.script.aculo.us/ajax/autocompleter
The prototype framework is described here:
http://www.sergiopereira.com/articles/prototype.js.html
I hope this helps as quickstart? If the suggest field is working it has
only to adapted to IRRE to set the accordant uid of a child record in
JavaScript - but this would be the next step.
olly
--
Oliver Hader
http://inpublica.de/
More information about the TYPO3-project-irre
mailing list