Fixed #115
This commit is contained in:
parent
19f0c3b6e9
commit
adb47db621
@ -192,7 +192,7 @@ angular.module('myApp.services', [])
|
|||||||
apiUser.rFirstName = RichTextProcessor.wrapRichText(apiUser.last_name, {noLinks: true, noLinebreaks: true}) || apiUser.rPhone || 'DELETED';
|
apiUser.rFirstName = RichTextProcessor.wrapRichText(apiUser.last_name, {noLinks: true, noLinebreaks: true}) || apiUser.rPhone || 'DELETED';
|
||||||
apiUser.rFullName = RichTextProcessor.wrapRichText(apiUser.last_name, {noLinks: true, noLinebreaks: true}) || apiUser.rPhone || 'DELETED';
|
apiUser.rFullName = RichTextProcessor.wrapRichText(apiUser.last_name, {noLinks: true, noLinebreaks: true}) || apiUser.rPhone || 'DELETED';
|
||||||
}
|
}
|
||||||
apiUser.sortName = $.trim((apiUser.last_name || '') + ' ' + apiUser.first_name);
|
apiUser.sortName = SearchIndexManager.cleanSearchText(apiUser.first_name + ' ' + (apiUser.last_name || ''));
|
||||||
apiUser.sortStatus = apiUser.status && (apiUser.status.expires || apiUser.status.was_online) || 0;
|
apiUser.sortStatus = apiUser.status && (apiUser.status.expires || apiUser.status.was_online) || 0;
|
||||||
|
|
||||||
|
|
||||||
@ -511,6 +511,7 @@ angular.module('myApp.services', [])
|
|||||||
return {
|
return {
|
||||||
createIndex: createIndex,
|
createIndex: createIndex,
|
||||||
indexObject: indexObject,
|
indexObject: indexObject,
|
||||||
|
cleanSearchText: cleanSearchText,
|
||||||
search: search
|
search: search
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -521,18 +522,24 @@ angular.module('myApp.services', [])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cleanSearchText (text) {
|
||||||
|
text = text.replace(badCharsRe, ' ').replace(trimRe, '').toLowerCase();
|
||||||
|
|
||||||
|
for (var key in accentsReplace) {
|
||||||
|
if (accentsReplace.hasOwnProperty(key)) {
|
||||||
|
text = text.replace(accentsReplace[key], key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
function indexObject (id, searchText, searchIndex) {
|
function indexObject (id, searchText, searchIndex) {
|
||||||
if (searchIndex.fullTexts[id] !== undefined) {
|
if (searchIndex.fullTexts[id] !== undefined) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
searchText = searchText.replace(badCharsRe, ' ').replace(trimRe, '').toLowerCase();
|
searchText = cleanSearchText(searchText);
|
||||||
|
|
||||||
for (var key in accentsReplace) {
|
|
||||||
if (accentsReplace.hasOwnProperty(key)) {
|
|
||||||
searchText = searchText.replace(accentsReplace[key], key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!searchText.length) {
|
if (!searchText.length) {
|
||||||
return false;
|
return false;
|
||||||
@ -561,13 +568,7 @@ angular.module('myApp.services', [])
|
|||||||
var shortIndexes = searchIndex.shortIndexes,
|
var shortIndexes = searchIndex.shortIndexes,
|
||||||
fullTexts = searchIndex.fullTexts;
|
fullTexts = searchIndex.fullTexts;
|
||||||
|
|
||||||
query = query.replace(badCharsRe, ' ').replace(trimRe, '').toLowerCase();
|
query = cleanSearchText(query);
|
||||||
|
|
||||||
for (var key in accentsReplace) {
|
|
||||||
if (accentsReplace.hasOwnProperty(key)) {
|
|
||||||
query = query.replace(accentsReplace[key], key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var queryWords = query.split(' '),
|
var queryWords = query.split(' '),
|
||||||
foundObjs = false,
|
foundObjs = false,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user