Merge branch 'r3.7'
This commit is contained in:
commit
c488c2387c
5 changed files with 84 additions and 19 deletions
|
@ -651,6 +651,10 @@ public class SearchUICore {
|
|||
this.parentSearchResult = parentSearchResult;
|
||||
return prev;
|
||||
}
|
||||
|
||||
public SearchResult getParentSearchResult() {
|
||||
return parentSearchResult;
|
||||
}
|
||||
|
||||
public List<SearchResult> getRequestResults() {
|
||||
return requestResults;
|
||||
|
@ -730,9 +734,9 @@ public class SearchUICore {
|
|||
object.localeName = object.alternateName;
|
||||
object.alternateName = null;
|
||||
}
|
||||
object.parentSearchResult = parentSearchResult;
|
||||
if (matcher == null || matcher.publish(object)) {
|
||||
count++;
|
||||
object.parentSearchResult = parentSearchResult;
|
||||
if (totalLimit == -1 || count < totalLimit) {
|
||||
requestResults.add(object);
|
||||
}
|
||||
|
@ -740,6 +744,7 @@ public class SearchUICore {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
boolean cancelled = request != requestNumber.get();
|
||||
|
|
|
@ -154,14 +154,10 @@ public class SearchCoreFactory {
|
|||
if (!ws.isEmpty() && api != null && api.isSearchAvailable(phrase)) {
|
||||
SearchPhrase nphrase = phrase.selectWord(res, ws,
|
||||
phrase.isLastUnknownSearchWordComplete());
|
||||
SearchResult prev = resultMatcher.setParentSearchResult(res);
|
||||
res.parentSearchResult = prev;
|
||||
resultMatcher.setParentSearchResult(res);
|
||||
api.search(nphrase, resultMatcher);
|
||||
resultMatcher.setParentSearchResult(prev);
|
||||
resultMatcher.setParentSearchResult(res.parentSearchResult);
|
||||
}
|
||||
// if (resultMatcher.getCount() == cnt) {
|
||||
// resultMatcher.publish(res);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -463,23 +463,24 @@ public class SearchPhrase {
|
|||
SearchPhrase sp = new SearchPhrase(this.settings, this.clt);
|
||||
addResult(res, sp);
|
||||
SearchResult prnt = res.parentSearchResult;
|
||||
while(prnt != null) {
|
||||
while (prnt != null) {
|
||||
addResult(prnt, sp);
|
||||
prnt = prnt.parentSearchResult;
|
||||
}
|
||||
sp.words.addAll(0, this.words);
|
||||
if (unknownWords != null) {
|
||||
sp.lastUnknownSearchWordComplete = lastComplete;
|
||||
StringBuilder genUnknownSearchPhrase = new StringBuilder();
|
||||
for (int i = 0; i < unknownWords.size(); i++) {
|
||||
if (i == 0) {
|
||||
sp.unknownSearchWordTrim = unknownWords.get(0);
|
||||
} else {
|
||||
sp.unknownWords.add(unknownWords.get(i));
|
||||
}
|
||||
genUnknownSearchPhrase.append(unknownWords.get(i)).append(" ");
|
||||
}
|
||||
// TODO
|
||||
// sp.rawUnknownSearchPhrase = rawUnknownSearchPhrase;
|
||||
// sp.unknownSearchPhrase = unknownSearchPhrase;
|
||||
|
||||
sp.rawUnknownSearchPhrase = sp.unknownSearchPhrase = genUnknownSearchPhrase.toString().trim();
|
||||
}
|
||||
return sp;
|
||||
}
|
||||
|
|
|
@ -179,14 +179,13 @@ public class SearchUICoreTest {
|
|||
for (SearchResult result : searchResults) {
|
||||
String expected = results.get(i++);
|
||||
String present = result.toString();
|
||||
//System.out.println(present);
|
||||
if(!Algorithms.stringsEqual(expected, present)) {
|
||||
if (!Algorithms.stringsEqual(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) {
|
||||
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()));
|
||||
// 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);
|
||||
|
|
|
@ -11,11 +11,10 @@
|
|||
},
|
||||
"phrase": "spring street",
|
||||
"results": [
|
||||
"Spring (Natural)",
|
||||
"Spring (Natural)",
|
||||
"Spring (Spring / Natural)",
|
||||
"Spring (Ice rink / Sport)",
|
||||
"Spring (Bridge / Transport construction)",
|
||||
"Spring Street, Cold Spring Harbor",
|
||||
"Spring Street, South Nyack",
|
||||
"Spring Street, Tomkins Cove",
|
||||
"Spring Street, Southfields",
|
||||
|
@ -35,6 +34,7 @@
|
|||
"Spring Street, Montgomery",
|
||||
"Spring Street, Chelsea",
|
||||
"Spring Street, Wappingers Falls",
|
||||
"Spring Street, Cold Spring Harbor",
|
||||
"Spring Street, Staten Island",
|
||||
"Spring Street, East Meadow",
|
||||
"Spring Street, Inwood",
|
||||
|
@ -101,7 +101,71 @@
|
|||
"Spring Street",
|
||||
"Spring Street",
|
||||
"Spring Street",
|
||||
"Spring Street"
|
||||
"Spring Street",
|
||||
"Academy Street, Cold Spring",
|
||||
"Bank Street, Cold Spring",
|
||||
"B Street, Cold Spring",
|
||||
"Cedar Street, Cold Spring",
|
||||
"Cherry Street, Cold Spring",
|
||||
"Chestnut Street, Cold Spring",
|
||||
"Church Street, Cold Spring",
|
||||
"Cross Street, Cold Spring",
|
||||
"East Belvedere Street, Cold Spring",
|
||||
"Fair Street, Cold Spring",
|
||||
"Fish Street, Cold Spring",
|
||||
"Furnace Street, Cold Spring",
|
||||
"Garden Street, Cold Spring",
|
||||
"Haldane Street, Cold Spring",
|
||||
"Hamilton Street, Cold Spring",
|
||||
"High Street, Cold Spring",
|
||||
"Main Street, Cold Spring",
|
||||
"Market Street, Cold Spring",
|
||||
"New Street, Cold Spring",
|
||||
"North Street, Cold Spring",
|
||||
"Oak Street, Cold Spring",
|
||||
"Orchard Street, Cold Spring",
|
||||
"Parrot Street, Cold Spring",
|
||||
"Parsonage Street, Cold Spring",
|
||||
"Pine Street, Cold Spring",
|
||||
"Rock Street, Cold Spring",
|
||||
"Stone Street, Cold Spring",
|
||||
"Wall Street, Cold Spring",
|
||||
"West Bank Street, Cold Spring",
|
||||
"West Belvedere Street, Cold Spring",
|
||||
"West Street, Cold Spring",
|
||||
"Chestnut Street, Cold Spring Harbor",
|
||||
"Flora Street, Cold Spring Harbor",
|
||||
"Grove Street, Cold Spring Harbor",
|
||||
"Main Street, Cold Spring Harbor",
|
||||
"Midland Street, Cold Spring Harbor",
|
||||
"Rusco Street, Cold Spring Harbor",
|
||||
"Spring Street, Cold Spring Harbor",
|
||||
"West Main Street, Cold Spring Harbor",
|
||||
"Kraw Street, Spring Glen",
|
||||
"Munro Street, Cold Spring",
|
||||
"State Street, Cold Spring",
|
||||
"Spring Street Salt Shed",
|
||||
"6th Avenue & Spring Street",
|
||||
"Spring Street Park",
|
||||
"Broadway & Spring Street",
|
||||
"Broadway/Spring Street",
|
||||
"Spring Street Station (6) - Downtown",
|
||||
"Spring Street Station (6) - Uptown & The Bronx",
|
||||
"Richmond Road & Spring Street",
|
||||
"West Spring Street School",
|
||||
"Spring Street Gallery",
|
||||
"Spring Street Apartments",
|
||||
"Spring Street",
|
||||
"Spring Street",
|
||||
"Spring Street",
|
||||
"Spring Street",
|
||||
"Spring Street",
|
||||
"Spring Street",
|
||||
"Spring Street",
|
||||
"Spring Street",
|
||||
"Spring Street",
|
||||
"Spring Street",
|
||||
"Spring Street",
|
||||
],
|
||||
"amenities": [
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue