Fix #11376
This commit is contained in:
parent
a657d71e06
commit
08baaf7004
2 changed files with 6 additions and 4 deletions
|
@ -55,7 +55,9 @@ public class SearchResult {
|
||||||
|
|
||||||
public double getSumPhraseMatchWeight() {
|
public double getSumPhraseMatchWeight() {
|
||||||
// if result is a complete match in the search we prioritize it higher
|
// if result is a complete match in the search we prioritize it higher
|
||||||
boolean match = requiredSearchPhrase.countWords(localeName) <= getSelfWordCount();
|
int localWordsMatched = alternateName != null ?
|
||||||
|
requiredSearchPhrase.countWords(alternateName) : requiredSearchPhrase.countWords(localeName) ;
|
||||||
|
boolean match = localWordsMatched <= getSelfWordCount();
|
||||||
double res = ObjectType.getTypeWeight(match ? objectType : null);
|
double res = ObjectType.getTypeWeight(match ? objectType : null);
|
||||||
if (parentSearchResult != null) {
|
if (parentSearchResult != null) {
|
||||||
res = res + parentSearchResult.getSumPhraseMatchWeight() / MAX_TYPE_WEIGHT;
|
res = res + parentSearchResult.getSumPhraseMatchWeight() / MAX_TYPE_WEIGHT;
|
||||||
|
|
|
@ -191,10 +191,10 @@ public class SearchUICoreTest {
|
||||||
if (!Algorithms.stringsEqual(expected, present)) {
|
if (!Algorithms.stringsEqual(expected, present)) {
|
||||||
System.out.println(String.format("Phrase: %s", phrase));
|
System.out.println(String.format("Phrase: %s", phrase));
|
||||||
System.out.println(String.format("Mismatch for '%s' != '%s'. Result: ", expected, present));
|
System.out.println(String.format("Mismatch for '%s' != '%s'. Result: ", expected, present));
|
||||||
|
}
|
||||||
for (SearchResult r : searchResults) {
|
for (SearchResult r : searchResults) {
|
||||||
System.out.println(String.format("\t\"%s\",", formatResult(false, r, phrase)));
|
System.out.println(String.format("\t\"%s\",", formatResult(false, r, phrase)));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Assert.assertEquals(expected, present);
|
Assert.assertEquals(expected, present);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue