Si está utilizando SolrSharp, no admite consultas negativas.
necesita cambiar QueryParameter.cs (Crear un nuevo parámetro)
private bool _negativeQuery = false;
public QueryParameter(string field, string value, ParameterJoin parameterJoin = ParameterJoin.AND, bool negativeQuery = false)
{
this._field = field;
this._value = value.Trim();
this._parameterJoin = parameterJoin;
this._negativeQuery = negativeQuery;
}
public bool NegativeQuery
{
get { return _negativeQuery; }
set { _negativeQuery = value; }
}
Y en la clase QueryParameterCollection.cs, el ToString() de anulación, se ve si el parámetro negativa es cierto
arQ[x] = (qp.NegativeQuery ? "-(" : "(") + qp.ToString() + ")" + (qp.Boost != 1 ? "^" + qp.Boost.ToString() : "");
Cuando llama al creador del parámetro, si es un valor negativo. el simple cambio propertie
List<QueryParameter> QueryParameters = new List<QueryParameter>();
QueryParameters.Add(new QueryParameter("PartnerList", "[* TO *]", ParameterJoin.AND, true));
Aunque la página SolrQuerySyntax dice -id: [* TO *], solo -id: ["" TO *] funcionó para mí en solr 1.4. –
¿No funciona '? Q = -id: *' también? – user2043553
@ user2043553 No, si '? Q = -id: *' obtienes 'No se puede analizar '-q: *': '*' o '?' no permitido como primer personaje en WildcardQuery' –