Merge branch 'r3.7'

This commit is contained in:
Victor Shcherb 2020-05-24 21:27:09 +02:00
commit beb36fdfe9
5 changed files with 103 additions and 58 deletions

View file

@ -146,7 +146,7 @@ public class SearchCoreFactory {
phrase.countUnknownWordsMatch(res); phrase.countUnknownWordsMatch(res);
// int cnt = resultMatcher.getCount(); // int cnt = resultMatcher.getCount();
List<String> ws = phrase.getUnknownSearchWords(res.otherWordsMatch); List<String> ws = phrase.getUnknownSearchWords(res.otherWordsMatch);
if(!res.firstUnknownWordMatches) { if (!res.firstUnknownWordMatches) {
ws.add(phrase.getUnknownSearchWord()); ws.add(phrase.getUnknownSearchWord());
} }
// publish result to set parentSearchResult before search // publish result to set parentSearchResult before search

View file

@ -468,7 +468,7 @@ public class SearchPhrase {
prnt = prnt.parentSearchResult; prnt = prnt.parentSearchResult;
} }
sp.words.addAll(0, this.words); sp.words.addAll(0, this.words);
if(unknownWords != null) { if (unknownWords != null) {
sp.lastUnknownSearchWordComplete = lastComplete; sp.lastUnknownSearchWordComplete = lastComplete;
for (int i = 0; i < unknownWords.size(); i++) { for (int i = 0; i < unknownWords.size(); i++) {
if (i == 0) { if (i == 0) {
@ -477,6 +477,9 @@ public class SearchPhrase {
sp.unknownWords.add(unknownWords.get(i)); sp.unknownWords.add(unknownWords.get(i));
} }
} }
// TODO
// sp.rawUnknownSearchPhrase = rawUnknownSearchPhrase;
// sp.unknownSearchPhrase = unknownSearchPhrase;
} }
return sp; return sp;
} }

View file

@ -40,8 +40,9 @@ public class SearchResult {
res = ObjectType.getTypeWeight(objectType); res = ObjectType.getTypeWeight(objectType);
} }
if (parentSearchResult != null) { if (parentSearchResult != null) {
// 5 is a maximum type // 10 > maximum type
res += parentSearchResult.getUnknownPhraseMatchWeight() / 5; // res = Math.max(res,parentSearchResult.getUnknownPhraseMatchWeight()) ;
res += parentSearchResult.getUnknownPhraseMatchWeight() / 10;
} }
return res; return res;
} }

View file

@ -181,9 +181,12 @@ public class SearchUICoreTest {
String present = result.toString(); String present = result.toString();
//System.out.println(present); //System.out.println(present);
if(!Algorithms.stringsEqual(expected, present)) { if(!Algorithms.stringsEqual(expected, present)) {
System.out.println(String.format("Mismatch for '%s' != '%s'. Result: ", expected, present)); System.out.println(String.format("Mismatch for '%s' != '%s' (%d, %.3f, %s). Result: ", expected,
present, result.getFoundWordCount(), result.getUnknownPhraseMatchWeight(), result.objectType.toString()));
for (SearchResult r : searchResults) { for (SearchResult r : searchResults) {
System.out.println("\t\""+r.toString()+"\","); System.out.println(String.format("\t\"%s\",", r.toString()));
// System.out.println(String.format("\"%s\", (%d, %.3f, %s),", r.toString(),
// r.getFoundWordCount(), r.getUnknownPhraseMatchWeight(), r.objectType.toString()));
} }
} }
Assert.assertEquals(expected, present); Assert.assertEquals(expected, present);

View file

@ -15,6 +15,7 @@
"Spring (Spring / Natural)", "Spring (Spring / Natural)",
"Spring (Ice rink / Sport)", "Spring (Ice rink / Sport)",
"Spring (Bridge / Transport construction)", "Spring (Bridge / Transport construction)",
"Spring Street, Cold Spring Harbor",
"Spring Street, South Nyack", "Spring Street, South Nyack",
"Spring Street, Tomkins Cove", "Spring Street, Tomkins Cove",
"Spring Street, Southfields", "Spring Street, Southfields",
@ -34,7 +35,6 @@
"Spring Street, Montgomery", "Spring Street, Montgomery",
"Spring Street, Chelsea", "Spring Street, Chelsea",
"Spring Street, Wappingers Falls", "Spring Street, Wappingers Falls",
"Spring Street, Cold Spring Harbor",
"Spring Street, Staten Island", "Spring Street, Staten Island",
"Spring Street, East Meadow", "Spring Street, East Meadow",
"Spring Street, Inwood", "Spring Street, Inwood",
@ -53,6 +53,44 @@
"Spring Street, Liberty", "Spring Street, Liberty",
"Spring Street (Livingston Manor), Rockland", "Spring Street (Livingston Manor), Rockland",
"Spring Street, Livingston Manor", "Spring Street, Livingston Manor",
"Market Street, Cold Spring",
"New Street, Cold Spring",
"West Street, Cold Spring",
"Fish Street, Cold Spring",
"North Street, Cold Spring",
"Rock Street, Cold Spring",
"Stone Street, Cold Spring",
"Wall Street, Cold Spring",
"Cross Street, Cold Spring",
"Main Street, Cold Spring",
"Chestnut Street, Cold Spring",
"Furnace Street, Cold Spring",
"Garden Street, Cold Spring",
"Church Street, Cold Spring",
"Oak Street, Cold Spring",
"Cherry Street, Cold Spring",
"High Street, Cold Spring",
"Academy Street, Cold Spring",
"Haldane Street, Cold Spring",
"West Bank Street, Cold Spring",
"B Street, Cold Spring",
"West Belvedere Street, Cold Spring",
"Parrot Street, Cold Spring",
"Bank Street, Cold Spring",
"Orchard Street, Cold Spring",
"East Belvedere Street, Cold Spring",
"Pine Street, Cold Spring",
"Parsonage Street, Cold Spring",
"Hamilton Street, Cold Spring",
"Fair Street, Cold Spring",
"Cedar Street, Cold Spring",
"Flora Street, Cold Spring Harbor",
"West Main Street, Cold Spring Harbor",
"Grove Street, Cold Spring Harbor",
"Midland Street, Cold Spring Harbor",
"Rusco Street, Cold Spring Harbor",
"Main Street, Cold Spring Harbor",
"Chestnut Street, Cold Spring Harbor",
"Spring Street", "Spring Street",
"Spring Street", "Spring Street",
"Spring Street", "Spring Street",