The standard search is by definition a word search. If instead you want to search for a phrase which includes more than one word eg “word1 word2” and your space, you will need to build a custom search and or use the various regular expressions.
Yes, sir. I have a custom search tab called Phrase to address literal searches. I have thought of converting/rewriting the phrase search to a “mixed” search. To do so, I thought of writing a separate search operator called mixedsearch or msearch. However, that is not the best solution. The better solution, from my point of view, is for the existing search operator to have a new flag… “mixed”, so we can do this…
[search:title,caption,text:mixed[my words some "in quotes" other not]]
To do this today I’d need to write it this like:
[search:title,caption,text[my words some other not]search:title,caption,text:literal[in quotes]]
And, aside, ‘mixed’ should be the default, not ‘word’.
Without the ‘mixed’ flag I might just write the msearch.
@clsturgeon the literal search mode is the answer!
Users may also sometimes want to switch between some/word and literal (or your variation) so it would be great if we had a search option for the standard sort. In this selection dropdown we could include a virtual search you call mixed.
But It would also be nice if we could add excludions as well. eg term -widget
This would make sence in the word search at least.
Being a console/command nerd, it would be cool to see the standard search expanded (Either by default, or via plugins) to also be a place where various commands etc could be run (This is why the Masquerading macro got me so excited ).
Especially in conjunction with the motion (VIM-like) plugin, because the “/” key gives the search box focus, so I could totally be a keyboard warrior. lol
@baiguai could you elaborate? Perhaps even in a new Topic?
Because I am not sure how Masquerading macro vs Masquerading titles.
We can already paste a full tiddler title in the search and hit enter to open that tiddler, and someone made a plugin to also hit enter to create new tiddlers.
Yeah, let me gather my thoughts on that, so far the Masquerade has been doing everything I need. But yeah, a new thread would be good for that discussion.
Thanks for these good suggestions!
My conclusion from your answers: there is currently no simple way for a user to enter a search string containing spaces in the standard search box. However, the Search in Fields plugin solves this problem effectively.
I think searching for a string with spaces should be accessible from the standard search box, if only because in the English language many simple concepts have spaces in them, like ‘hen house’. Maybe the Search in Fields plugin could be integrated with the standard search box. Another possibility could be to indicate ‘literal spaces’ f.i. with a backslash, as in
@SjaakA The following may help. As I said I was willing to write a “mixed” search feature.
Import the attach json file, which incudes 2 tiddlers. One that generates a custom advanced search tab (as per @TW_Tones) suggested. The other is a JavaScript macro that will convert the user input into a filter that TW supports.
It supports quoted phrases alongside words that are not in quotes. As per @TW_Tones suggestion, it also supports words prefixed with a minus sign, which instructs the mixed search to include tiddlers that do not have this word. i.e. if the word exists do not include the tiddler in the search results.
If you want to use the minus sign with a phrase, include the minus sign inside the quotes:
“search this phrase” “-but not this phase”
For this to work, you need to save your project and reload it. DO NOT FORGET. It will not work until you do.
It will add a new tab “Mixed” (under the Standard tab).
I can now remove my “Phrase” tab… which is redundant.
One more point… The title search results only search the title field for the results. “The Other” results searches all these fields “title,text,description,caption,date,photocaption” to fit my needs. Edit the mmsearch line (at the top) in $:/plugins/cls/mk/ui/MixedSearchResultList to change the field list to fit your needs. I guess I should make this configuration.
Using regex in the regular search box without having to do complex acrobatics would be really useful. I’m not a “pro” TW user but I do use it every day and I am familiar with regex. I can do so much more with regex.
But my guess is TW runs on Javascript so it would have to be JS flavored regex.
Thanks to all the people who have helped me over the years.
@Craig, I imported your MixedAdvanceSearch.json and it works terrific, thanks! It does exactly what I wanted, and more.
I also imported the Search Fields plugin by @Mohammad, which is even more powerful, but still needs going to the Advanced Search for a literal search (i.e. with spaces). Thanks also!