Hi Eric,

Many thanks for the instruction.

Have tried but unable to get it work. I created a tiddler with a custom
field called "title2", with a search config tiddler
([[zzSearchOptionsConfig]]) that goes like:

//{{{
window.formatSearchResults_list=function(text,matches) {
    // bullet list of links to matching tiddlers
    var body='';
    var co=config.options; // abbrev
    var pattern=co.chkRegExpSearch?text:text.escapeRegExp();
    var sensitive=co.chkCaseSensitiveSearch?"mg":"img";
    var link='{{tiddlyLinkExisting{<html><nowiki><a href="javascript:;"
onclick="'
        +'if(config.options.chkSearchHighlight)'
        +'    highlightHack=new RegExp(\x27'+pattern+'\x27.escapeRegExp

(),\x27'+sensitive+'\x27);'
        +'story.displayTiddler(null,\x27%0\x27);'
        +'highlightHack = null; return false;'
        +'" title="%2">%1</a></html>}}}';
    for(var t=0;t<matches.length;t++) {
        body+="* ";
        if (co.chkSearchByDate)
            body+=matches[t].modified.formatString('YYYY.0MM.0DD

0hh:0mm')+" ";
        var title=matches[t].title;
        var fixup=store.getValue(tid,"title2");
        fixup=fixup.replace(/'/g,"\\x27").replace(/"/g,"\\x22");
        var tid=store.getTiddler(title);
        var tip=tid?tid.getSubtitle():''; tip=tip.replace(/"/g,"&quot;");
        body+=link.format([fixup,title,tip])+'\n';
    }
    return body;
}
//}}}


Yet, nothing show up when I do a search. Could you give some more help?

On 1 August 2010 01:34, Eric Shulman <[email protected]> wrote:

> > Wonder whether it is possible to config SearchOptionPlugin or
> > SimpleSearchPlugin to NOT to show tiddler titles in search result, but
> > value from a custom field (say a field called "alternative_title")?
>
> http://www.TiddlyTools.com/#SearchOptionsPlugin
>
> is specifically designed to permit *redefintion* of the search result
> output functions.
>
> In order to customiz the list content, the function you want to change
> is called
>   window.formatSearchResults_list()
>
> First, go to the SearchOptionsPlugin, and edit the source.  Scroll
> down until you find the above function definition, and copy it to the
> clipboard.
>
> Next, create a separate tiddler (e.g., SearchOptionsPluginConfig),
> tagged with systemConfig, and paste in the copied code, like this:
>
> //{{{
> window.formatSearchResults_list=function(text,matches) {
>        ...
> }
> //}}}
>
> Then, replace this ONE line:
>        var fixup=title.replace(/'/g,"\\x27").replace(/"/g,"\\x22");
> with something like this:
>        var fixup=store.getValue(tid,"fieldname");
>        fixup=fixup.replace(/'/g,"\\x27").replace(/"/g,"\\x22");
>
> Of course, you will need a bit more code to get the desired fieldname
> based on current language selection, but I leave that as "an exercise
> for the reader".
>
> enjoy,
> -e
>
> --
> You received this message because you are subscribed to the Google Groups
> "TiddlyWiki" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<tiddlywiki%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/tiddlywiki?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.

Reply via email to