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

@ -12,58 +12,96 @@
"phrase": "spring street", "phrase": "spring street",
"results": [ "results": [
"Spring (Natural)", "Spring (Natural)",
"Spring (Spring / Natural)", "Spring (Spring / Natural)",
"Spring (Ice rink / Sport)", "Spring (Ice rink / Sport)",
"Spring (Bridge / Transport construction)", "Spring (Bridge / Transport construction)",
"Spring Street, South Nyack", "Spring Street, Cold Spring Harbor",
"Spring Street, Tomkins Cove", "Spring Street, South Nyack",
"Spring Street, Southfields", "Spring Street, Tomkins Cove",
"Spring Street, Hastings-on-Hudson", "Spring Street, Southfields",
"Spring Street, Pleasantville", "Spring Street, Hastings-on-Hudson",
"Spring Street (Mount Pleasant), Hawthorne", "Spring Street, Pleasantville",
"Spring Street, Durland", "Spring Street (Mount Pleasant), Hawthorne",
"Spring Street, Warwick", "Spring Street, Durland",
"Spring Street, Nelsonville", "Spring Street, Warwick",
"Spring Street, Goshen", "Spring Street, Nelsonville",
"Spring Street (Little Italy), Manhattan", "Spring Street, Goshen",
"Spring Street, Maybrook", "Spring Street (Little Italy), Manhattan",
"West Spring Street, Maybrook", "Spring Street, Maybrook",
"Spring Street, South Salem", "West Spring Street, Maybrook",
"Spring Street, Groveville", "Spring Street, South Salem",
"Spring Street, East Middletown", "Spring Street, Groveville",
"Spring Street, Montgomery", "Spring Street, East Middletown",
"Spring Street, Chelsea", "Spring Street, Montgomery",
"Spring Street, Wappingers Falls", "Spring Street, Chelsea",
"Spring Street, Cold Spring Harbor", "Spring Street, Wappingers Falls",
"Spring Street, Staten Island", "Spring Street, Staten Island",
"Spring Street, East Meadow", "Spring Street, East Meadow",
"Spring Street, Inwood", "Spring Street, Inwood",
"Spring Street, Port Jervis", "Spring Street, Port Jervis",
"Spring Street, Roosevelt", "Spring Street, Roosevelt",
"Spring Street, Pawling", "Spring Street, Pawling",
"Spring Street, Fairview", "Spring Street, Fairview",
"Spring Street (Wyandanch), Wheatley Heights", "Spring Street (Wyandanch), Wheatley Heights",
"Spring Street, Wyandanch", "Spring Street, Wyandanch",
"Spring Street, East Massapequa", "Spring Street, East Massapequa",
"Spring Street, Ellenville", "Spring Street, Ellenville",
"Spring Street, Monticello", "Spring Street, Monticello",
"Spring Street, Tillson", "Spring Street, Tillson",
"Spring Street, Port Jefferson", "Spring Street, Port Jefferson",
"Spring Street (Smallwood), Bethel", "Spring Street (Smallwood), Bethel",
"Spring Street, Liberty", "Spring Street, Liberty",
"Spring Street (Livingston Manor), Rockland", "Spring Street (Livingston Manor), Rockland",
"Spring Street, Livingston Manor", "Spring Street, Livingston Manor",
"Spring Street", "Market Street, Cold Spring",
"Spring Street", "New Street, Cold Spring",
"Spring Street", "West Street, Cold Spring",
"Spring Street", "Fish Street, Cold Spring",
"Spring Street", "North Street, Cold Spring",
"Spring Street", "Rock Street, Cold Spring",
"Spring Street", "Stone Street, Cold Spring",
"Spring Street", "Wall Street, Cold Spring",
"Spring Street", "Cross Street, Cold Spring",
"Spring Street", "Main Street, Cold Spring",
"Spring Street" "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",
"Spring Street",
"Spring Street",
"Spring Street",
"Spring Street",
"Spring Street"
], ],
"amenities": [ "amenities": [
{ {