Skip to content

Commit

Permalink
Updated similar() and useful()
Browse files Browse the repository at this point in the history
  • Loading branch information
romanchyla committed Sep 12, 2019
1 parent 8667bf6 commit 2304371
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ public Query parse(FunctionQParser fp) throws SyntaxError {
new SecondOrderCollectorTopN(200)),
new SecondOrderCollectorCitesRAM(referencesWrapper));

outerQuery.getcollector().setFinalValueType(FinalValueType.ABS_COUNT_NORM);
outerQuery.getcollector().setFinalValueType(FinalValueType.ABS_COUNT);
return outerQuery;
};
});
Expand Down Expand Up @@ -1096,7 +1096,7 @@ public Query parse(FunctionQParser fp) throws SyntaxError {

SolrQueryRequest req = fp.getReq();
String input = fp.getString();
String filterName = input.substring(1, input.length()-1);
String filterName = input.substring(1, input.length()-1).trim();


// pick the content stream (actually a filter)
Expand Down Expand Up @@ -1189,11 +1189,11 @@ public Query parse(FunctionQParser fp) throws SyntaxError {
public Query parse(FunctionQParser fp) throws SyntaxError {
String input = fp.parseId();

String toLoad = "abstract";
String toLoad = "abstract title";
if (fp.hasMoreArguments())
toLoad = fp.parseId();

int maxQueryTerms = 500;
int maxQueryTerms = 100;
if (fp.hasMoreArguments())
maxQueryTerms = Math.min(fp.parseInt(), maxQueryTerms);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1222,7 +1222,8 @@ public void testOtherCases() throws Exception {
assertQ(req("q", "title:\"GBT Survey of 50 Faint Fermi\"~2"),
"//*[@numFound>='4']");


//TODO: this test is intentionally left failing; it used to work until the scoring changes (i'd like to
// investigate more how the multi-token affects recall)
assertQ(req("q", "title:\"A 350-MHz GBT Survey of 50 Faint Fermi γ-ray Sources for Radio Millisecond Pulsars\"",
"indent", "true",
"debugQuery", "true"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ public void testSpecialCases() throws Exception {
MatchNoDocsQuery.class);

assertQueryEquals(req("defType", "aqp", "q", "similar(bibcode:XXX)"),
"+like:foo bar baz -BitSetQuery(1)",
"+like:foo bar baz title bitle -BitSetQuery(1)",
BooleanQuery.class);

assertQueryEquals(req("defType", "aqp", "q", "similar(bibcode:XXX, title)"),
Expand Down Expand Up @@ -979,11 +979,11 @@ public void testSpecialCases() throws Exception {

// useful() - ads classic implementation
assertQueryEquals(req("defType", "aqp", "q", "useful(author:foo)"),
"SecondOrderQuery(SecondOrderQuery(SecondOrderQuery(author:foo, author:foo,*, collector=SecondOrderCollectorAdsClassicScoringFormula(cache=citations-cache, boost=float[] cite_read_boost, lucene=0.5, adsPart=0.5)), collector=SecondOrderCollectorTopN(200)), collector=SecondOrderCollectorCitesRAM(cache:citations-cache))",
"SecondOrderQuery(SecondOrderQuery(author:foo, author:foo,*, collector=SecondOrderCollectorTopN(200)), collector=SecondOrderCollectorCitesRAM(cache:citations-cache))",
SecondOrderQuery.class);

assertQueryEquals(req("defType", "aqp", "q", "all:(x OR z) useful(author:foo OR title:body)"),
"+(all:x all:z) +SecondOrderQuery(SecondOrderQuery(SecondOrderQuery((author:foo, author:foo,*) title:body, collector=SecondOrderCollectorAdsClassicScoringFormula(cache=citations-cache, boost=float[] cite_read_boost, lucene=0.5, adsPart=0.5)), collector=SecondOrderCollectorTopN(200)), collector=SecondOrderCollectorCitesRAM(cache:citations-cache))",
"+(all:x all:z) +SecondOrderQuery(SecondOrderQuery((author:foo, author:foo,*) title:body, collector=SecondOrderCollectorTopN(200)), collector=SecondOrderCollectorCitesRAM(cache:citations-cache))",
BooleanQuery.class);


Expand All @@ -997,11 +997,11 @@ public void testSpecialCases() throws Exception {

// reviews() - ADS classic impl
assertQueryEquals(req("defType", "aqp", "q", "reviews(author:foo)"),
"SecondOrderQuery(SecondOrderQuery(SecondOrderQuery(author:foo, author:foo,*, collector=SecondOrderCollectorAdsClassicScoringFormula(cache=citations-cache, boost=float[] cite_read_boost, lucene=0.5, adsPart=0.5)), collector=SecondOrderCollectorTopN(200)), collector=SecondOrderCollectorCitedBy(cache:citations-cache))",
"SecondOrderQuery(SecondOrderQuery(author:foo, author:foo,*, collector=SecondOrderCollectorTopN(200)), collector=SecondOrderCollectorCitedBy(cache:citations-cache))",
SecondOrderQuery.class);

assertQueryEquals(req("defType", "aqp", "q", "all:(x OR z) reviews(author:foo OR title:body)"),
"+(all:x all:z) +SecondOrderQuery(SecondOrderQuery(SecondOrderQuery((author:foo, author:foo,*) title:body, collector=SecondOrderCollectorAdsClassicScoringFormula(cache=citations-cache, boost=float[] cite_read_boost, lucene=0.5, adsPart=0.5)), collector=SecondOrderCollectorTopN(200)), collector=SecondOrderCollectorCitedBy(cache:citations-cache))",
"+(all:x all:z) +SecondOrderQuery(SecondOrderQuery((author:foo, author:foo,*) title:body, collector=SecondOrderCollectorTopN(200)), collector=SecondOrderCollectorCitedBy(cache:citations-cache))",
BooleanQuery.class);

// reviews2() - original impl
Expand Down Expand Up @@ -1249,7 +1249,7 @@ public void testSubquery() throws Exception {
streams.add(cs);


SolrQueryRequestBase req = (SolrQueryRequestBase) req("qt", "/bigquery", "q","(docs(fq_foo) OR docs(fq_bar)) AND bibcode:b4");
SolrQueryRequestBase req = (SolrQueryRequestBase) req("qt", "/bigquery", "q","(docs(fq_foo) OR docs(fq_bar)) AND bibcode:b4", "debugQuery", "true");
req.setContentStreams(streams);

assertQ(req,
Expand Down

0 comments on commit 2304371

Please sign in to comment.