Calculator in Searchbox
-
04-10-2020 - |
题
I'm following the link http://blogs.msdn.com/b/carloshm/archive/2012/12/16/how-to-use-query-rules-and-display-templates-to-detect-the-intent-of-your-users.aspx
to build a calculator out of the searchbox. I modified the regular expression to:
\d+\s*[/+-/*]\s*\d+
But I don't get it working with e.g. 23462634746-4
The reason I think is, that there are no results found in my SharePoint Local Results.
I also tried the regex:
[^d]*[/+/-/*/\][^d]*
But the calculator is only working if there is an item in SharePoint which contains something out of the query.
So I probably have to modifiy the query for the result block but only want the query to match if there is a calculation in the query.
解决方案
Change the query to something like "*" so you get a result.
其他提示
I published now a Step-by-Step guide for the calculator in my Blog.
Don't be afraIT.com to check it out.