Would something like this work for you?
\function title.list() [format:titlelist[]join[ ]]
\procedure results-list(template:"$:/plugins/JJ/multimenu/AliasTemplate")
<$list filter="[enlist<condition>sort[title]limit[250]]" template=<<template>> />
\end
<$let
searchText={{{ [<searchTiddler>get[text]] }}}
>
<% if [!is[system]search:title<searchText>] +[title.list[]] %>
//<small>im Titel: <br></small>//
<<results-list>>
<% endif %>
<% if [!is[system]search:alias<searchText>] -[!is[system]search:title<searchText>] +[title.list[]] %>
//<small>Alias-Titel</small>//
<<results-list>>
<% endif %>
<% if [!is[system]search:text<searchText>] -[!is[system]search:alias<searchText>] -[!is[system]search:title<searchText>] +[title.list[]] %>
//<small>im Text:</small>//
<<results-list>>
<% endif %>
</$let>
Here, I’m taking advantage of the <<condition>> variable Eric mentioned. A standard <% if ... %> statement will save only the first result of the filter as the value of <<condition>> (behind the scenes, it automatically adds limit[1].) But if we use format:titlelist[]join[ ] to save the entire list of results as a single string in title-list format, we can then use enlist<condition> inside the conditional to retrieve the full contents of the list.
Here’s what that looks like without the function/procedure I added for brevity above:
<% if [!is[system]search:title<searchText>] +[format:titlelist[]join[ ]] %>
//<small>im Titel: <br></small>//
<$list filter="[enlist<condition>sort[title]limit[250]]" template="$:/plugins/JJ/multimenu/AliasTemplate" />
<% endif %>
To cut down on repeated content, I defined a custom function title.list…
\function title.list() [format:titlelist[]join[ ]]
And a custom procedure that wraps the inner $list:
\procedure results-list(template:"$:/plugins/JJ/multimenu/AliasTemplate")
<$list filter="[enlist<condition>sort[title]limit[250]]" template=<<template>> />
\end
You seemed to be using $:/plugins/JJ/multimenu/AliasTemplate as the list template in all cases, so I made it the default value of the template parameter. But if you want to use a different template for a particular list, you can simply declare it as part of the procedure-call, e.g.
<<results-list MyAlternateTemplate>>
You’ll also notice I moved the sort and limit steps out of the outer filter (which determines whether anything should be displayed) and into the inner filter used in <<results-list>>. Sorting can be time-consuming, so it’s generally best to do it at the last possible moment — i.e., when the content is actually being rendered.
As you can see, my suggested code above does still include some recalculation of previously-used filters, as in [!is[system]search:text<searchText>] -[!is[system]search:alias<searchText>] -[!is[system]search:title<searchText>]. If you wanted to further improve your search efficiency, you could save each step as a precalculated title list in a variable…
\function title.list() [format:titlelist[]join[ ]]
\procedure results-list(template:"$:/plugins/JJ/multimenu/AliasTemplate")
<$list filter="[enlist<condition>sort[title]limit[250]]" template=<<template>> />
\end
<$let
searchText={{{ [<searchTiddler>get[text]] }}}
titleResults={{{ [!is[system]search:title<searchText>] +[title.list[]] }}}
aliasResults={{{ [!is[system]search:alias<searchText>] -[enlist<titleResults>] +[title.list[]] }}}
textResults={{{ [!is[system]search:text<searchText>] -[enlist<aliasResults>] -[enlist<titleResults>] +[title.list[]] }}}
>
<% if [<titleResults>!match[]] %>
//<small>im Titel: <br></small>//
<<results-list>>
<% endif %>
<% if [<aliasResults>!match[]] %>
//<small>Alias-Titel</small>//
<<results-list>>
<% endif %>
<% if [<textResults>!match[]] %>
//<small>im Text:</small>//
<<results-list>>
<% endif %>
</$let>
This will likely be somewhat faster in a large wiki, since you’re reducing the number of times you have to search all your non-system tiddlers. Whether it feels visually simpler or not is probably a matter of user preference.
As a side note, I did a lot of copy-pasting while writing this… hopefully it didn’t introduce any errors, but if you find one, please let me know. 