private boolean fetchPhaseShouldFreeContext(SearchContext context) { if (context.scrollContext() == null) { // simple search, no scroll return true; } else { // scroll request, but the scroll was not extended return context.scrollContext().scroll == null; } }
@Override public SearchContext scrollContext(ScrollContext scroll) { return in.scrollContext(scroll); }
@Override public ScrollContext scrollContext() { return in.scrollContext(); }
@Override public String toString() { StringBuilder result = new StringBuilder().append(shardTarget()); if (searchType() != SearchType.DEFAULT) { result.append("searchType=[").append(searchType()).append("]"); } if (scrollContext() != null) { if (scrollContext().scroll != null) { result.append("scroll=[").append(scrollContext().scroll.keepAlive()).append("]"); } else { result.append("scroll=[null]"); } } result.append(" query=[").append(query()).append("]"); return result.toString(); } }
public void freeAllScrollContexts() { for (SearchContext searchContext : activeContexts.values()) { if (searchContext.scrollContext() != null) { freeContext(searchContext.id()); } } }
public boolean freeContext(long id) { final SearchContext context = removeContext(id); if (context != null) { assert context.refCount() > 0 : " refCount must be > 0: " + context.refCount(); try { context.indexShard().getSearchOperationListener().onFreeContext(context); if (context.scrollContext() != null) { openScrollContexts.decrementAndGet(); context.indexShard().getSearchOperationListener().onFreeScrollContext(context); } } finally { context.close(); } return true; } return false; }
if (context.queryResult().hasSearchContext() == false && context.scrollContext() == null) { freeContext(context.id()); } else {
private boolean fetchPhaseShouldFreeContext(SearchContext context) { if (context.scrollContext() == null) { // simple search, no scroll return true; } else { // scroll request, but the scroll was not extended return context.scrollContext().scroll == null; } }
@Override public ScrollContext scrollContext() { return in.scrollContext(); }
private boolean fetchPhaseShouldFreeContext(SearchContext context) { if (context.scrollContext() == null) { // simple search, no scroll return true; } else { // scroll request, but the scroll was not extended return context.scrollContext().scroll == null; } }
private boolean fetchPhaseShouldFreeContext(SearchContext context) { if (context.scrollContext() == null) { // simple search, no scroll return true; } else { // scroll request, but the scroll was not extended return context.scrollContext().scroll == null; } }
} else if (searchContext.scrollContext() != null) { return new ScrollingTopDocsCollectorContext(reader, query, searchContext.scrollContext(), searchContext.sort(), numDocs, searchContext.trackScores(), searchContext.numberOfShards(), searchContext.trackTotalHits(), hasFilterCollector);
private void processScroll(InternalScrollSearchRequest request, SearchContext context) throws IOException { // process scroll context.from(context.from() + context.size()); context.scrollContext().scroll = request.scroll(); // update the context keep alive based on the new scroll value if (request.scroll() != null && request.scroll().keepAlive() != null) { contextScrollKeepAlive(context, request.scroll().keepAlive().millis()); } }
public CollapseContext build(SearchContext context) { if (context.scrollContext() != null) { throw new SearchContextException(context, "cannot use `collapse` in a scroll context");
long time = System.nanoTime(); queryPhase.execute(context); if (context.queryResult().hasSearchContext() == false && context.scrollContext() == null) {
contextProcessing(context); if (request.lastEmittedDoc() != null) { context.scrollContext().lastEmittedDoc = request.lastEmittedDoc();
assert query == searcher.rewrite(query); // already rewritten final ScrollContext scrollContext = searchContext.scrollContext(); if (scrollContext != null) { if (scrollContext.totalHits == -1) {
public void freeAllScrollContexts() { for (SearchContext searchContext : activeContexts.values()) { if (searchContext.scrollContext() != null) { freeContext(searchContext.id()); } } }
public void freeAllScrollContexts() { for (SearchContext searchContext : activeContexts.values()) { if (searchContext.scrollContext() != null) { freeContext(searchContext.id()); } } }
private void processScroll(InternalScrollSearchRequest request, SearchContext context) { // process scroll context.from(context.from() + context.size()); context.scrollContext().scroll = request.scroll(); // update the context keep alive based on the new scroll value if (request.scroll() != null && request.scroll().keepAlive() != null) { context.keepAlive(request.scroll().keepAlive().millis()); } }