private void prepareRankFeaturesFromModel(Ranking ranking) { Item root = getQueryTree().getRoot(); if (root != null) { List<Item> tagged = setUniqueIDs(root); addLabels(tagged, ranking); addConnectivityRankProperties(tagged, ranking); addSignificances(tagged, ranking); } }
/** Returns a string describing this query */ @Override public String toString() { String queryTree; // getQueryTree isn't exception safe try { queryTree = model.getQueryTree().toString(); } catch (Exception e) { queryTree = "[Could not parse user input: " + model.getQueryString() + "]"; } return "query '" + queryTree + "'"; }
/** * Encodes this query onto the given buffer * * @param buffer The buffer to encode the query to * @return the number of encoded items */ public int encode(ByteBuffer buffer) { return model.getQueryTree().encode(buffer); }
@Override public int hashCode() { return getClass().hashCode() + QueryHelper.combineHash(encoding,filter,language,getQueryTree(),sources,restrict,defaultIndex,type,searchPath); }
@Override public Object get(CompoundName name,Map<String,String> context, com.yahoo.processing.request.Properties substitution) { return super.get(name, context == null ? requestMap : context, substitution); }
/** Returns the session id of this query, and creates and assigns it if not already present */ public SessionId getSessionId(String serverId) { if (requestId == null) requestId = UniqueRequestId.next(serverId); return new SessionId(requestId, getRanking().getProfile()); }
/** * Prepares this for binary serialization. * <p> * This must be invoked after all changes have been made to this query before it is passed * on to a receiving backend. Calling it is somewhat expensive, so it should only happen once. * If a prepared query is cloned, it stays prepared. */ public void prepare() { getModel().prepare(getRanking()); getPresentation().prepare(); getRanking().prepare(); }
/** Sets sorting from a string. See {@link Sorting} on syntax */ public void setSorting(String sortingString) { if (sortingString==null) setSorting((Sorting)null); else setSorting(new Sorting(sortingString)); }
@Override public FieldOrder clone() { return new FieldOrder(fieldSorter.clone(), sortOrder); } }
/** * Invoked during deep cloning of the parent query. */ public void setParentQuery(Query query) { if (chained() != null) chained().setParentQuery(query); } }
/** * Sets the set of types (document type or search definition names) this query will search from a * comma-separated string of type names. This is useful to narrow a search to just a subset of the types available * from a sources */ public void setRestrict(String restrictString) { setFromString(restrictString,restrict); }
@Override public Map<String, Object> listProperties(CompoundName path,Map<String,String> context, com.yahoo.processing.request.Properties substitution) { return super.listProperties(path, context == null ? requestMap : context, substitution); }
@Override public boolean equals(Object other) { if (!(other instanceof RawSorter)) { return false; } return super.equals(other); } }
/** * Returns the name of this attribute */ public String getFieldName() { return fieldSorter.getName(); }