Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Switch to a "contains" semantics for search #1

Merged
merged 2 commits into from

2 participants

@esjewett

The existing implementation only searches for the term entered in the search box at the beginning of the search string. For example, a search for "content" will find nothing, but a user would normally expect to find "Business Content and Extractors" and "Portal Content Development". This change finds terms where the search term appears anywhere in the forum name.

@qmacro qmacro commented on the diff
sdnforumsearch.html
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
-<script src="/~dj/sapui5/sapui5-static/resources/sap-ui-core.js"
+<script src="./sap-ui-core.js"
@qmacro Owner
qmacro added a note

I understand where you're coming from with this change, but am curious: with sap-ui-core.js in the same directory, does that imply that all the rest of the sapui5-static/resources files are in that same root-level directory alongside this HTML file? I want to get to a situation where we can have the resources held in a single (abstract) place. Or am I missing the point?

(Hmm, perhaps we can get SAP to host...?)

Well, if it was at a central location that would be good, but barring that it makes more sense to me to have it in the same directory rather than somewhere that only exists on one machine. The normal practice would be to host the sap-ui-core.js file in the same Git repository as the application, but given SAP's licensing restrictions that is not possible. Just one more way that SAP is shooting itself in the foot with developer licensing.

@qmacro Owner
qmacro added a note

SAPUI5 is too huge to host in same dir as app. So will assume / suggest a 'definitive' dir to use as convention: '/sapui5/' like this:

<script src="/sapui5/sap-ui-core.js">...

And each user can replace that with whatever is relevant for them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@qmacro qmacro commented on the diff
sdnforumsearch.html
((11 lines not shown))
var aResult = [];
for (var i = 0; i < aSdnForums.length; i++) {
- if (!sPrefix || sPrefix.length == 0 || jQuery.sap.startsWithIgnoreCase(aSdnForums[i], sPrefix)) {
+ if (!sTerm || sTerm.length == 0 || re.test(aSdnForums[i])) {
@qmacro Owner
qmacro added a note

Like this. The original is, as you say, too restrictive, and also a bit ugly anyway (startsWith...).

When I looked at the UI5 library I was kind of shocked to see these utility methods and not jQuery.sap.containsIgnoreCase(). So RegExp it is!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@qmacro qmacro merged commit cacc9b0 into qmacro:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 26, 2012
  1. @esjewett

    Use a relative reference. Really the UI5 JS file should be included i…

    esjewett authored
    …n the project, but unfortunately that is not allowed under SAP's license.
  2. @esjewett
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 4 deletions.
  1. +5 −4 sdnforumsearch.html
View
9 sdnforumsearch.html
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
-<script src="/~dj/sapui5/sapui5-static/resources/sap-ui-core.js"
+<script src="./sap-ui-core.js"
@qmacro Owner
qmacro added a note

I understand where you're coming from with this change, but am curious: with sap-ui-core.js in the same directory, does that imply that all the rest of the sapui5-static/resources files are in that same root-level directory alongside this HTML file? I want to get to a situation where we can have the resources held in a single (abstract) place. Or am I missing the point?

(Hmm, perhaps we can get SAP to host...?)

Well, if it was at a central location that would be good, but barring that it makes more sense to me to have it in the same directory rather than somewhere that only exists on one machine. The normal practice would be to host the sap-ui-core.js file in the same Git repository as the application, but given SAP's licensing restrictions that is not possible. Just one more way that SAP is shooting itself in the foot with developer licensing.

@qmacro Owner
qmacro added a note

SAPUI5 is too huge to host in same dir as app. So will assume / suggest a 'definitive' dir to use as convention: '/sapui5/' like this:

<script src="/sapui5/sap-ui-core.js">...

And each user can replace that with whatever is relevant for them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
type="text/javascript"
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.ui.commons"
@@ -28,13 +28,14 @@
});
// Load the plugin to use 'jQuery.sap.startsWithIgnoreCase'
- jQuery.sap.require("jquery.sap.strings");
+ // jQuery.sap.require("jquery.sap.strings");
// Filter the forums according to the given prefix
- var filterSdnForums = function (sPrefix) {
+ var filterSdnForums = function (sTerm) {
+ var re = new RegExp(sTerm,"i")
var aResult = [];
for (var i = 0; i < aSdnForums.length; i++) {
- if (!sPrefix || sPrefix.length == 0 || jQuery.sap.startsWithIgnoreCase(aSdnForums[i], sPrefix)) {
+ if (!sTerm || sTerm.length == 0 || re.test(aSdnForums[i])) {
@qmacro Owner
qmacro added a note

Like this. The original is, as you say, too restrictive, and also a bit ugly anyway (startsWith...).

When I looked at the UI5 library I was kind of shocked to see these utility methods and not jQuery.sap.containsIgnoreCase(). So RegExp it is!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
aResult.push(aSdnForums[i]);
}
}
Something went wrong with that request. Please try again.