Update search result
This commit is contained in:
parent
3db30ffe8d
commit
41c812903a
1 changed files with 12 additions and 24 deletions
|
@ -74,24 +74,22 @@ public class SearchResult {
|
||||||
if (otherWordsMatch != null) {
|
if (otherWordsMatch != null) {
|
||||||
searchPhraseNames.addAll(otherWordsMatch);
|
searchPhraseNames.addAll(otherWordsMatch);
|
||||||
}
|
}
|
||||||
int idxMatchedWord = -1;
|
int idxMatchedWord = -1;
|
||||||
boolean allWordsMatched = true;
|
boolean allWordsMatched = true;
|
||||||
if (!checkPhraseIsObjectType()) {
|
for (int i = 0; i < searchPhraseNames.size(); i++) {
|
||||||
for (int i = 0; i < searchPhraseNames.size(); i++) {
|
boolean wordMatched = false;
|
||||||
boolean wordMatched = false;
|
for (int j = idxMatchedWord + 1; j < localResultNames.size(); j++) {
|
||||||
for (int j = idxMatchedWord + 1; j < localResultNames.size(); j++) {
|
int r = requiredSearchPhrase.getCollator().compare(searchPhraseNames.get(i), localResultNames.get(j));
|
||||||
int r = requiredSearchPhrase.getCollator().compare(searchPhraseNames.get(i), localResultNames.get(j));
|
if (r == 0) {
|
||||||
if (r == 0) {
|
wordMatched = true;
|
||||||
wordMatched = true;
|
idxMatchedWord = j;
|
||||||
idxMatchedWord = j;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!wordMatched) {
|
|
||||||
allWordsMatched = false;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!wordMatched) {
|
||||||
|
allWordsMatched = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
double res = ObjectType.getTypeWeight(allWordsMatched ? objectType : null);
|
double res = ObjectType.getTypeWeight(allWordsMatched ? objectType : null);
|
||||||
if (parentSearchResult != null) {
|
if (parentSearchResult != null) {
|
||||||
|
@ -100,16 +98,6 @@ public class SearchResult {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkPhraseIsObjectType() {
|
|
||||||
// if (object instanceof Amenity) {
|
|
||||||
// String poiType = ((Amenity) object).getType().getKeyName();
|
|
||||||
// String poiSubType = ((Amenity) object).getSubType();
|
|
||||||
// boolean isType = poiType.equalsIgnoreCase(phrase);
|
|
||||||
// boolean isSubType = poiSubType.equalsIgnoreCase(phrase);
|
|
||||||
// return isType || isSubType;
|
|
||||||
// }
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue