## Not signed in

Want to take part in these discussions? Sign in if you have an account, or apply for one below

## Site Tag Cloud

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

• CommentRowNumber1.
• CommentAuthorMike Shulman
• CommentTimeJun 6th 2011

Continuing discussion from here.

Firstly, we do have a FAQ entry.

The point, as Urs said, is that the casual visitor is not made aware near the search box that regexps are on by default, nor does the casual web surfer necessarily know how to escape special characters in a regular expression, or even which characters are special and need escaping, or even what a regular expression is, or that there might be some “feature” of the search box which requires investigation of the FAQ. A casual visitor who searches for “(1,2)-category” and comes up with nothing is most likely to conclude “there is no page about (1,2)-categories” rather than “hmm, maybe I should look at the FAQ to find out whether there is some weird behavior of instiki’s search box that is preventing me from finding a page that actually exists.”

I suggest that we get together and decide whether there is a way to modify Instiki to make it more friendly in this regard, and then ask Jacques if such a change is possible.

• CommentRowNumber2.
• CommentAuthorAndrew Stacey
• CommentTimeJun 6th 2011

I didn’t know that we already had an FAQ entry. That’s good to know.

I completely agree that the interface could do with improving. Here’s a minimal suggestion. On the search page, when it gives you the results, at the top it says something like:

Not what you’re looking for? Instiki’s search uses regular expressions which means that some special characters (such as .*()) have special meaning. To learn more about how to search effectively, go to this page.

I would like to make a plea that the regular expression nature of the search be kept. I regularly get frustrated by the fact that I can’t do more complicated searches in Google. I agree that not being told that the search uses regular expressions is suboptimal, but not being about to use regular expressions is also suboptimal.

(Although as I have the nLab on my desktop as text files, I can always run my complicated searches via grep on the command line. But then I’m special.)

Another possibility would be for a mouseover text when the focus is in the search box that says: “Instiki’s search uses regular expressions” with a link to how to find out more.

• CommentRowNumber3.
• CommentAuthorUrs
• CommentTimeJun 6th 2011

I agree that the regexp search is good, but it is more for the advanced reader and probably for contributors. It would be great to have quick-and-easy search function for the typical reader.

I imagine best would be if we could have in addition to the regexp search box a little Google-powered box, that automatically starts a Google search with the “site:” command.

So the user types “(1,2)-category” and the sofware sends Google the request

  "(1,2)-category" site:http://ncatlab.org/nlab/


I suppose it is easy to include such a box in the content of the HomePage (I mean, as opposed to have it hard-wired in instiki) by adding some sort of hyperlink to some Google service? I never tried to figure out how this works, but I see that some private websites seems to have this.

• CommentRowNumber4.
• CommentAuthorMike Shulman
• CommentTimeJun 6th 2011

I gather from your choice of article that you’re one of those people who pronounces “FAQ” as “eff-ei-cue”. (-:

I agree that regexp searches should still be available. But I don’t think the default search obtained from the search box at the top of every page should be a regexp search.

I suppose it is easy to include such a box

I certainly know how to do it with raw HTML (just make a form that submits to http://www.google.com/search”). Not sure about Markdown or CSS.

• CommentRowNumber5.
• CommentAuthorAndrew Stacey
• CommentTimeJun 6th 2011

I certainly know how to do it with raw HTML

Sounds like a worthy addition to the front page, at least until we decide what we can do for a more general solution. Just make sure that you convert your raw HTML to raw XHTML (basically, use lowercase tag names and non-paired tags should end with a < ... />). A form ought to get by the XHTML sanitiser. If it doesn’t work, we haven’t lost anything.

• CommentRowNumber6.
• CommentAuthorTobyBartels
• CommentTimeJun 7th 2011

I used to (back when only sophisticated computer geeks designed big web sites) often see two search functions on a site: a user-friendly one and fancy one. (Sometimes the latter only appeared after the former gave its results.) We could (with Jacques’s help) do that here.

• CommentRowNumber7.
• CommentAuthorMike Shulman
• CommentTimeJun 7th 2011

Okay, there’s something there, have a look. Is there a way to get the text box on the same line as the text preceeding it?

• CommentRowNumber8.
• CommentAuthorMike Shulman
• CommentTimeJun 7th 2011

It’s also working kind of weirdly for me right now. E.g. searching for “trace” turns up only two entries, neither of which is trace.

• CommentRowNumber9.
• CommentAuthorDavidRoberts
• CommentTimeJun 7th 2011

Yes - very strange. Searching for ’trace nlab’ in google directly gives better results. Searching for “2-category” in the google box at HomePage doesn’t turn up 2-category, but 2-category of 2-dimensional cobordisms and 2 pdf files.

• CommentRowNumber10.
• CommentAuthorRodMcGuire
• CommentTimeJun 7th 2011

It’s also working kind of weirdly for me right now.

Google doesn’t guarantee their searches (unless you sign a license with them and maybe install software on your machine to create an up-to-date index for your site). Google has thousands of machines and any particular search request may be sent to a machine that may not have the most recent or complete indicies. This variation is most glaring when one uses the same somewhat specific search on different days and each time the total count of matches is different.

Sometimes it is just luck whether a complex search will find a page that it should. I’ve tried searching for a comment I made at a particular web site and some days it turns up and some days not, I presume because having a complete index of all the idiot comments at that website is not a high priority for all machines that Google might employ to answer my search.

Google seems to me mostly good and gives a high priority to indexing the nLab - I myself have not noticed any lapses though some of you folks appear to be shunted to their cruddy servers that know less than they should.

• CommentRowNumber11.
• CommentAuthorUrs
• CommentTimeJun 7th 2011

I have changed the site URL to search in to “http://nlab.mathforge.org/”. That helps. Searching now for “trace” gives the entry with that name as first hit.

Other searches also seem to show up the relevant entries, even though the order of the is not always the expected one. For instance searching “category” shows loads of entries with “category” in their name, but not the netry of that name itself (at least not on the first few pages of Google results).

Do we maybe need to make it search in “http://nlab.mathforge.org/” and in “http://www.ncatlab.org” (how can one do this?). Did the change of URL mix Google up a bit?

• CommentRowNumber12.
• CommentAuthorDavidRoberts
• CommentTimeJun 7th 2011

Note also that pagerank may not take into account the exact match of the name of the page and the search term!

• CommentRowNumber13.
• CommentAuthorRodMcGuire
• CommentTimeJun 7th 2011

I’ve updated the Greasemonkey script I posted in the emptypage thread. There I noticed that part of the reason to have an “emptypage” is to have some minimal place to access search from because the behavior of the nLab search box is to replace the page from where the search is made with the search results. Instead my script gave the option of making the search results appear in a new tab and thus one did not need to set up a dummy starting point that would get replaced.

The updated userscript (below) adds two buttons to the right of the nLab search box. The first toggles between → and ↓ to indicate whether the search should appear in a new tab to the right (→) or should replace the current tab (↓ ) (this state is remembered for the user by using “localStorage”.) The second button labeled “G” can be clicked on to perform a Google search that obeys the first button state. Internal nLab search is still executed by typing a “return” in the search box but it obeys the state of the arrow button.

Most of this functionality could probably be incorporated into the site HTML/JavaScript without digging down into the actual Instiki code. The only thing I’m not sure of is whether page JavaScript can ask that a new tab be opened next to the existing one.

One additional option would be to add a mechanism to toggle between whether the nLab search enables “RegExps” or not (which the default of being enabled can be confusing to the uninitiated). In the unenabled state the search string could be escaped so that no characters are interpreted as RegExp control characters.

The nLab RegExp search is very hard to use for searches that are simple in Google syntax. For example “negative universal” given to Google will return pages that contain both “negative” and “universal” (and on the tail end may return some pages that contain just one of these terms). I have yet to construct a nLab RegExp to do a similar search. One would need a RegExp that searches for “negative” followed after a while by “universal” and also checks for the reverse order.

I also think that full RegExp searches of nLab must be horribly expensive in terms of CPU cycles. If I could figure out how to search for “negative AND universal” I would expect it to spend a lot of time grinding through all the nLab pages. Maybe there is some “grind limit” that prevents such searches from working.

Finally the below userscript has been tested in Firefox 3.6.17 and Greasemonkey 0.9.3. I was auto-upgraded to GM 0.9.5 but found that GM_openInTab didn’t work properly so I reverted back to 0.9.3

// ==UserScript==
// @name           nLab better search
// @namespace      ~rm
// @description    adds buttons to embetter nlab search - in new tabs or  through google.
// @include        http://ncatlab.org/nlab/show/*
// @include        http://ncatlab.org/nlab/search*
// @include        http://ncatlab.org/nlab/recently_revised
// ==/UserScript==

function submitForm(e){ // overide the submit form action
e.preventDefault();
nlabSearch();
}
function searchInNew(){ // true if togButton is right arrow
return (togButton.value == "\u2192") ?  true : false;
}
function nlabSearch(){
var search = document.getElementById("searchField").value; // input text field
var ns = "http://ncatlab.org/nlab/search?query=" + search;
if (searchInNew()) GM_openInTab(ns)
else document.location = ns;
}
GS = "+site:http://ncatlab.org/nlab";

var search = document.getElementById("searchField").value; // input text field
var gs = GH + search + GS;
if (searchInNew()) GM_openInTab(gs)
else document.location = gs;
}
function clickToggle(e){
togButton.value = (togButton.value == "\u2192") ? "\u2193" : "\u2192";
localStorage.setItem("searchArrow", togButton.value);
}
function Main(){
var nE = document.getElementById("navEnd"); // empty span after search box
nE.innerHTML = ''
+ '<input type="button" value="\u2192"'
+ ' title="click to toggle whether search appers in this tab(\u2193)'
+ ' or new tab(\u2192)" />'
+ '<input type="button" value="G"'
togButton = nE.childNodes[0]; // GLOBAL
var searchArrow = localStorage.getItem("searchArrow");
if (searchArrow) togButton.value = searchArrow;
var googButton = nE.childNodes[1];
}
Main();

• CommentRowNumber14.
• CommentAuthorAndrew Stacey
• CommentTimeJun 7th 2011

I see a couple of useful threads in the above discussion.

1. How can we improve the search ability right now. The Greasemonkey script looks useful, but of course would only be there for “experienced users” who know to install it. Adding javascript is a whole order of magnitude easier than tinkering with the core code so it would be possible to transfer it. Adding CSS is even easier, of course, so things like pure CSS tooltips that pop-up when you hover over the search form would also be possible. The search box on the HomePage looks nice, but I haven’t tried it yet so can’t comment on that.

2. In our ideal world, what would the search interface be like? If we could have an “advanced search” page, what types of search would be useful for us to have there? If the “search” on every page was a simplified search, what are the KISS principles that would apply?

Jacques is always open to ideas on how to improve Instiki, but I prefer to say, “Here’s how we think it could be better” rather than “Here’s what we don’t like”. Also, my thoughts aren’t always in tune with everyone else’s so it’s good to thrash ideas around a bit first.

• CommentRowNumber15.
• CommentAuthorUrs
• CommentTimeJun 7th 2011

what would the search interface be like?

As the search on Wikipedia.

How do they do it?

• CommentRowNumber16.
• CommentAuthorAndrew Stacey
• CommentTimeJun 7th 2011

http://en.wikipedia.org/wiki/Help:Searching shows that their algorithm is very complicated. They also have special characters, such as * and () (though they don’t list all of what is considered special in a convenient list!). As with Insitki, their search engine searches in the source text.

• CommentRowNumber17.
• CommentAuthorMike Shulman
• CommentTimeJun 8th 2011

Ah, it’s the “www” in front of “ncatlab.org” that messes it up for some reason. Searching for “site:http://ncatlab.org/nlab” works fine.

• CommentRowNumber18.
• CommentAuthorMike Shulman
• CommentTimeJun 8th 2011

re: 1, given that right now we can’t change the fact that the search box on every page uses regexps, I think a hovering warning might be helpful. I don’t know how to do that, though. The warning could also suggest the search box on the main page, and also to the Firefox search plugins which are very easy to install, and maybe the greasemonkey. Maybe we should make a page right now called Searching the nLab with all of this information.

re: 2, I think the search bar visible at the top of every page would ideally go through Google, with an easy-to-find link (next to it, maybe) taking the user to an Advanced Search page that would do a regexp/source/math search.

• CommentRowNumber19.
• CommentAuthorUrs
• CommentTimeJun 8th 2011
• (edited Jun 8th 2011)

I have made a box around the Google-search form on our HomePage. I have tried to vertically align it with the Contents-box right next to it. Thought that would look nice. But my control of html is not good enough. I used a weird, crude and isufficient hack to get it done. If anyone sees what kind of look I am after and can implement it, I think it’d be nice.

• CommentRowNumber20.
• CommentAuthorAndrew Stacey
• CommentTimeJun 8th 2011

I had a go at Searching the nLab.

• CommentRowNumber21.
• CommentAuthorMike Shulman
• CommentTimeJun 8th 2011

That looks great to me!