Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions deploy/adsabs/server/solr/collection1/conf/solrconfig.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
You can disable the cache/and cache-warming/ by setting the values
to zero
-->
<!--
<cache name="citations-cache"
class="solr.CitationLRUCache"
size="${solr.citationCache.size:512}"
Expand All @@ -157,6 +158,7 @@
dumpCache="${montysolr.enable.write:true}"
loadDumpedCache="${montysolr.load.citation_cache:true}"
/>
-->

<enableLazyFieldLoading>true</enableLazyFieldLoading>

Expand Down Expand Up @@ -796,17 +798,21 @@
<requestHandler name="/perf" class="perf.CreatePerformanceQueriesHandler">
</requestHandler>

<!--
<transformer name="citations" class="org.apache.solr.response.transform.CitationsTransformerFactory" >
<str name="cache-name">citations-cache</str>
<str name="resolution-field">bibcode</str>
</transformer>
-->

<transformer name="fields" class="org.apache.solr.response.transform.FieldTransformerFactory" >
</transformer>

<queryParser name="bitset" class="solr.search.BitSetQParserPlugin">
<lst name="defaults">
<!--
<str name="cache-mapping">bibcode:citations-cache</str>
-->
<str name="allowed-fields">bibcode,recid</str>
</lst>
</queryParser>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,11 @@
import org.apache.solr.schema.IndexSchema;
import org.apache.solr.schema.SchemaField;
import org.apache.solr.search.*;
import org.apache.lucene.search.join.JoinUtil;
import org.apache.lucene.search.join.ScoreMode;
import org.apache.solr.servlet.SolrRequestParsers;
import org.apache.solr.uninverting.UninvertingReader;

import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;


/**
Expand Down Expand Up @@ -626,9 +623,15 @@ public Query parse(FunctionQParser fp) throws SyntaxError {
public Query parse(FunctionQParser fp) throws SyntaxError {
Query innerQuery = fp.parseNestedQuery();

CitationCache<Object, Integer> citationCache = (CitationCache<Object, Integer>) fp.getReq().getSearcher().getCache("citations-cache");
if (citationCache == null) {
// TODO: Perform citation query without the cache???
return innerQuery;
}

@SuppressWarnings("unchecked")
SolrCacheWrapper<CitationCache<Object, Integer>> citationsWrapper = new SolrCacheWrapper.CitationsCache(
(CitationCache<Object, Integer>) fp.getReq().getSearcher().getCache("citations-cache"));
citationCache);

return new SecondOrderQuery(innerQuery,
new SecondOrderCollectorCitedBy(citationsWrapper), false);
Expand Down Expand Up @@ -1075,7 +1078,7 @@ public Query parse(FunctionQParser fp) throws SyntaxError {

final SolrQueryRequest req = fp.getReq();
@SuppressWarnings("rawtypes") final CitationCache cache = (CitationCache) req.getSearcher().getCache("citations-cache");
if (!cache.isWarmingOrWarmed()) {
if (cache != null && !cache.isWarmingOrWarmed()) {
if (cache.size() > 0) {
return new MatchNoDocsQuery(); // we only allow it once (solr warms caches after first searcher was opened)
}
Expand Down