Hi,

we developed a custom QParserPlugin for Solr 4.3. This QParser is for comparing the numeric values of the documents with numeric values of the search query. The first step was to reduce the number of documents by pre parsing the request and creating a lucene query:

    final String queryString = "myField:" + preParse(searchString);
    final QParser parser = getParser(queryString, "lucene", getReq());

Then we used an FilteredQuery to select only matching records (which will then get scored):

this.innerQuery = new MyQuery(new FilteredQuery(parser.parse(), new MyFilter(searchString)));

This worked really well. But now we want to update to Solr 5.5. There the FilteredQuery is marked as deprecated.
The documentation says:

FilteredQuery will be removed in Lucene 6.0. It should be replaced with a BooleanQuery with one BooleanClause.Occur.MUST clause for the query and one BooleanClause.Occur.FILTER clause for the filter.

But I don't know how to do this. Is there any tutorial for this?

I would start with:

    BooleanQuery.Builder builder = new BooleanQuery.
    builder.add(parser.parse(), BooleanClause.Occur.MUST);
builder.add(new MyFilterQuery(searchString), BooleanClause.Occur.FILTER);
    this.innerQuery = builder.build();

But how do I get MyFilterQuery to filter my results?

Thank you for your time and you help!
-Oliver

Reply via email to