2D Search - a better way to visualize and construct complex nested Boolean queries?

Boolean query in 2D Search for Lens.org (sneak peak)
In a fairly popular 2014 blog post entitled "Why Nested Boolean search statements may not work as well as they did", I set out the case for why for the majority of users, doing overly complicated nested boolean is unlikely to be of much additional value.
Argument rested on two main arguments. Firstly, most of the academic search engines our users employ today do not expect users to enter complicated Boolean nested searches and as such the search algorithm is not optimized for such searches.
Secondly, the value of complicated nested Boolean is unclear when we go beyond searching specific disciplinary A&I (abstract and indexing) databases to searching large cross disciplinary indexes with full text matching. For example, I observed the typical user searching Google Scholar, Google or a Library discovery service is likely to explode their search results if they try to add additional synonyms to match in the full text because in a cross disciplinary database , a word such as "migration" can be used in totally different contexts without the existence of a controlled vocabulary scheme to mitigate this.
I ended off by saying there are exceptions to this view and noted that among other use cases, Medical librarians doing precision searches with controlled vocabulary such as looking for documents for systematic reviews in PubMed was an exception to the rule.
If you are involved in such searches, you are in luck in this blog post, I'm going to share a tool - 2D Search which can help you manage and create complex Boolean search strategies. (See also a journal article recently published in Weave Journal of Library Experience on the thinking behind this tool).
Not a medical librarian or don't use PubMed? Stick around and I will share at the end of the blog post, a exciting new development of 2Dsearch in the works, where it is posed to support the open, free and cross-disciplinary Lens.org allowing you to go beyond just medical/life science queries.
Warning : I am not a medical librarian, and do not do use PubMed or systematic review work on a day to day basis. So take what I say about this with a pinch of salt.
The need for visualization of complicated Boolean searches
While I don't do systematic reviews, I do find myself reaching out for complicated Boolean searches in one use case.
When looking for a starting point in an area of area, I like to teach my users to look for systematic reviews, meta-analysis or any other reference rich publication type on any topic to help kick start your literature search.
In this Medium post, I shared the following search strategy to do so for any topic.

My sample advanced Boolean Query in Lens.org to find reference rich content
This is in fact a relatively easy search query, but can you tell what I'm trying to do? Conversely did I make any errors in the search string?
If you are like me, the visualization below looks easier to understand what the strategy aims to do.

Visualization of the same Boolean search - is this clearer?
Clearly you can see the small block on the left is meant to match documents of the topic in question ("Creativity" is the topic but you can replace with any topic of interest), while the block on the right is to match items that are systematic reviews, review articles, meta-analysis and bibliographies.
The right block is split into two sub-blocks. As noted in my post, one of them uses Microsoft Academic Graph's Field of study (controlled vocab) while the other block uses keyword which is uncontrolled so I added variants for "meta-analysis" to try to match them.
Trying to use this in Lens.org currently can be a pain. Firstly, you have to trust that I have done the strategy correctly (good luck checking if I have closed all the parenthesis) . Secondly, unless you want to literally find stuff on Creativity, you will have to edit the long search string and hope you don't make any errors.
Is there anything better?
2D Search helps with complex Boolean by visualizing the search
Librarians trained to do systematic review will find the search strategy above laughably simple (e.g. you could extend it further by extending the strategy to matches words like "review" in titles which increases recall at expense of precision). They deal with far more complicated queries such as this filter for cancer.
In fact when using PubMed you don't actually type in this query but you can simply do cancer [sb] which will activity that complicated search. But this is for illustrative purposes.
The equivalent of my Lens.org search above in PubMed is the clinical query search strategy used to create the PubMed systematic review filter.
Here's how the strategy looks like (again you don't actually have to run this search, in PubMed there is a built-in filter that does all this, so this is just for illustration).
(((systematic review[ti] OR systematic literature review[ti] OR systematic scoping review[ti] OR
systematic narrative review[ti] OR systematic qualitative review[ti] OR systematic evidence review[ti] OR
systematic quantitative review[ti] OR systematic meta-review[ti] OR systematic critical review[ti] OR
systematic mixed studies review[ti] OR systematic mapping review[ti] OR systematic cochrane review[ti] OR
systematic search and review[ti] OR systematic integrative review[ti]) NOT comment[pt] NOT (protocol[ti] OR
protocols[ti])) NOT MEDLINE [subset]) OR (Cochrane Database Syst Rev[ta] AND review[pt]) OR
systematic review[pt] PubMed systematic review filter
Clear as mud isn't it? Especially if you aren't an expert on the syntax. Most librarians even those not trained in PubMed can probably guess ti=title. I can tell you pt=publication type, and ta=Journal title.
Does that help?
This is where 2D search comes in. It allows you to parse Pubmed searches to visualize the search strategy.
First login to 2D search and select "enter query string"

Parsing PubMed Search Query in 2D search
Cut and paste the query string in. At the time of writing, there is a bug where spaces between sentences will cause 2D Search to parse the strategy incorrectly, so either remove them manually or using some tool.

Parsing PubMed Search Query in 2D search
2D Search will parse the PubMed search strategy and provide three possible visualizations of the search strategy. I've put up a shareable link to it here.
The default is the nested view.

Shareable link to try - default nested view
Another view that you can get which I favor is the inline view. I've labelled some of the boxes to help a little with the intent of each nested container.

Shareable link to try - switch to inline view
Lastly the "Tree view", creates a hierarchical tree view that you can drill down or expand as needed to see more details.

Shareable link to try - switch to tree view
If you are like me, first time staring at these images, it may still not be very enlightening.
I highly recommend you go into this interactive example and see for yourself how this strategy works.
But let me try to walk you through, using the inline view (below)

Shareable link to try (change to inline view)
Firstly from the right side on canvas, we can see we are pooling documents from two sets of searches using the OR function
a) pt: systematic review - catches all documents that have the publication type systematic review. These are explictly tagged but were only done since 2019.
b) ta:Cochrane Database syst Rev OR pt:review - This smaller block, matches reviews that are in Cochrane database.
Needing for more explanation of the intent of the big block on the left side of the canvas?
We can see the inner most block on the left, is matching documents with various variants in the title
AND
we exclude anything that is pubtype:Review (notice the block is black which in 2D search means NOT is applied)
AND
we exclude anything that has the word protocol or protocols to exclude protocol.
This three innermost blocks are then combined (AND) with exclusion of subset of PubMed.
Whatever remaining is "ORed" with the first 2 blocks already mentioned above.
You can also see how many results you would get from PubMed with this search is 214k (white text in blue box on the right upper corner)
Combining queries in 2D Search
Besides creating shareable links to the visualizations you can of course save the queries. I decided to try to combine the strategy strategy for finding systematic reviews with documents on COVID-19.
For identifying COVID-19 documents I used the strategy below.
And now visualizing @tcshields revised #expertsearching COVID-19 search string, which is quite different. Note that interpretation of the intent (i.e. labels) behind each block is mine https://t.co/RiFMN4x5M8 pic.twitter.com/W9pwz2Fdyz
— 2Dsearch: think outside the search box (@2d_search) March 19, 2020
It was then easy to just combine the two complicated strategies together by putting them all in one big container.

Combined search strategy for finding COVID-19, systematic reviews
Creating complex Boolean searches from the scratch in 2D Search
Of course, besides parsing existing PubMed search strategies, you can also create your own from the scratch or edit existing ones. In fact, I am told, parsing of queries is in fact not a major use case.
So how is 2D search when used to craft complex Boolean searches?
It took me 15-30 minutes of playing around with it before I got really into it.
The main operational tricks are
How to change a container to a NOT function (right click - select "Apply NOT" and the box becomes black)
How to represent a field specific search (type out the term, right click - select "Add field tag")
How to combine two search strategies you copied together
The last took me a long while, and my solution was to create a bigger b;pcl and add both existing search strategies.
Talking to the creator of 2D Search Tony Russell-Rose, he mentioned to me in fact there was an easier way to combine them together.
All you need to do is to cut and paste two strategies into the overall "canvas", and 2D Search would automatically "AND" both groups of strategies because the overall "canvas" serves as an overall final container.
Other cool functions that I did not try is the suggest terms function

Suggest terms function in 2D Search
Which uses combination of word vectors and MESH

Suggest MESH terms function in 2D Search
How 2D Search helps with crafting of complex Boolean search strategies
My limited experience creating complex Boolean is that as the search queries get more complicated it gets really hard to keep track of all the logic. I tend to spend a lot of effort trying to ensure all the nested parentheses are properly closed for example.
2D Search's metaphor of blocks/containers allows you to bypass this issue and you no longer have to worry about parentheses closing and focus on the search you want to construct.
Labeling each block also helps to remind others (and yourself!) , the intent of each block, making each search more transparent and easier to audit.

Labeling of each block helps with transparency of search intent
But it can also help in other ways.
As you create more and more complicated search strategies, you often need to quickly see the effect of adding or removing a certain block.
In 2D search, you can quickly right click any block and disable it to check it's effect (or lack of) on the search results.

Disable blocks in 2D Search
For example, you might want to check the effect the block that is matching titles for words like systematic review has on the results. So you can click right click disable it and look at the number of results and compare with it enabled. You can of course re-enable it again. If you find adding a certain block has no effect on number of results, you might not want to include it to simplify the search.
Similarly you can execute only a certain block to see the impact of only that part of the search.
Both features allow you to create most efficient search strategies and avoid creating unnecessarily complicated strategies that don't have any impact.
If you do a bit of coding these features feel similar to commenting out lines of code to see it's effect.
Showing results and converting between search engines.
Of course just showing visualizations would not be useful if you couldn't execute the search strategy to look at results and you can indeed do this in 2D Search,
Besides PubMed (new version) it also supports a limited number of other search databases including general ones like Google and Bing as well as specific ones like Google Scholar, Trip Database and Epistemonikos.
Of course these different searches would have different syntax and functionality , so when you try to change an existing search strategy built to work with say PubMed to say Google, it will try to warn you that in Google, various field searches don't work.

I suspect systematic review librarians would be thinking this function of translation of searches across databases would be very useful , but currently it supports a limited set of them that people might use (PubMed via NLM but not the OVID/Ebsco platform and Google Scholar) and it's unclear to me how accurate the translation is.
Conclusion
I admit I have been aware of 2D Search for a while, but only recently I have seen the light. Still most people I know, even researchers or librarians may not have the need for use of this because they either don't do Boolean, or create relatively simple ones.
But if you tend to do complicated Boolean queries and need to reuse them or share them, 2D Search is right up your alley.
It allows you to quickly visualize existing strategies or craft complicated ones from scratch using a visual interface.
Once you get use to the visual interface, you can quickly create complicated search strategies without worrying about brackets. The feature to quickly enable and disable blocks allow you to quickly assess and validate the effects of different parts of your search strategy on the overall result.
But of course some of you might be thinking all this is very nice, but I don't work in medical or life sciences fields and 2D search supports primarily medical databases like PubMed or general web search like Google.
Google Scholar is included, but it is so limited in syntax that you rarely want to do complicated Boolean anyway.
This is where I can report the exciting news that 2D Search is planning to support Lens.org soon!
edit: 2nd May 2020 : 2D Search now supports Lens.org! (Try this search strategy I crafted)
Why is Lens.org the perfect search engine to couple with 2D search
It is multi-disciplinary and comprehensive drawing from sources like Microsoft Academic Graph, Crossref, Pubmed, CORE, Unpaywall and more
It allows very advanced Boolean searching with dozens of filters.
In particular it combines controlled vocabulary from Microsoft Academic, MESH, allowing fine grained controlled searching
Add other functionality like the super generous 50,000 record export limit and state of art visualization features, it is almost a match made in heaven.
Thinking of it as PubMed but for all disciplines is not a very bad way to think about it.

Boolean query in 2D Search for Lens.org
The search above gives you a taste of the power you can unleash combining Lens.org with 2D search.
It uses the following multi-faceted strategies to look for systematic reviews, meta-analysis etc
Matching of Microsoft Academic Graph (MAG) - controlled vocab
Marching of Keywords - uncontrolled subjects
Matching of PubMed - Supplementary Publication type
Matching of words (e.g. Literature review in title) - These will have higher recall but lower precision, so some are disabled by default - which you can easily turn on to try out
Then it tries to further increase precision by removing Lens publication types like libguide, dataset and PubMed publication types like Book reviews.
You will notice this search even more complicated than the original one I started this post with (2D search) Why? The reason was while I could think of ways to improve the search back then (in particular adding matches by title), I did not think it was worth doing so and risk making an error.
With 2D search, this was no longer a consideration and I could easily modify and tinker with it to my heart's content (Though I worried about exceeding some character limit, such that the browser truncates the search).
A scenario if I may.....
Imagine you are a PHD student who want a starting point to get a quick review of the field. You just copy this search strategy above, change the parts that refer to Creativity (my standard default topic) to your topic and get a beautifully executed search strategy that searches one of the largest sources of academic data out there.
While you can export, the records (limited 50k), you probably would prefer to play with the visualization features to see if anything common stands out.

Some visualizations in Len.org generated from the 500 reviews found on Creativity
Happy hacking with Boolean!

