Try to fix #9329
This commit is contained in:
parent
9320935467
commit
f1c7d7e276
2 changed files with 14 additions and 8 deletions
|
@ -55,11 +55,11 @@ public enum ObjectType {
|
|||
return 4;
|
||||
case STREET:
|
||||
return 3;
|
||||
case POI:
|
||||
return 2;
|
||||
case CITY:
|
||||
case VILLAGE:
|
||||
case POSTCODE:
|
||||
return 2;
|
||||
case POI:
|
||||
return 1;
|
||||
default:
|
||||
return 1;
|
||||
|
|
|
@ -49,13 +49,14 @@ public class SearchResult {
|
|||
|
||||
// maximum corresponds to the top entry
|
||||
public double getUnknownPhraseMatchWeight() {
|
||||
// if result is a complete match in the search we prioritize it highers
|
||||
// if result is a complete match in the search we prioritize it higher
|
||||
return getSumPhraseMatchWeight() / Math.pow(MAX_TYPE_WEIGHT, getDepth() - 1);
|
||||
}
|
||||
|
||||
public double getSumPhraseMatchWeight() {
|
||||
// if result is a complete match in the search we prioritize it highers
|
||||
double res = ObjectType.getTypeWeight(objectType);
|
||||
// if result is a complete match in the search we prioritize it higher
|
||||
boolean match = requiredSearchPhrase.countWords(localeName) <= getSelfWordCount();
|
||||
double res = match ? ObjectType.getTypeWeight(objectType) : 0;
|
||||
if (parentSearchResult != null) {
|
||||
res = res + parentSearchResult.getSumPhraseMatchWeight() / MAX_TYPE_WEIGHT;
|
||||
}
|
||||
|
@ -70,6 +71,14 @@ public class SearchResult {
|
|||
}
|
||||
|
||||
public int getFoundWordCount() {
|
||||
int inc = getSelfWordCount();
|
||||
if (parentSearchResult != null) {
|
||||
inc += parentSearchResult.getFoundWordCount();
|
||||
}
|
||||
return inc;
|
||||
}
|
||||
|
||||
private int getSelfWordCount() {
|
||||
int inc = 0;
|
||||
if (firstUnknownWordMatches) {
|
||||
inc = 1;
|
||||
|
@ -77,9 +86,6 @@ public class SearchResult {
|
|||
if (otherWordsMatch != null) {
|
||||
inc += otherWordsMatch.size();
|
||||
}
|
||||
if (parentSearchResult != null) {
|
||||
inc += parentSearchResult.getFoundWordCount();
|
||||
}
|
||||
return inc;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue