Java Code Examples for org.apache.solr.search.QParser#parse()

The following examples show how to use org.apache.solr.search.QParser#parse() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AlfrescoReRankQParserPlugin.java    From SearchServices with GNU Lesser General Public License v3.0 6 votes vote down vote up
public Query parse() throws SyntaxError {
    String reRankQueryString = localParams.get("reRankQuery");
    boolean scale = localParams.getBool("scale", false);
    QParser reRankParser = QParser.getParser(reRankQueryString, null, req);
    Query reRankQuery = reRankParser.parse();

    int reRankDocs  = localParams.getInt("reRankDocs", 200);
    reRankDocs = Math.max(1, reRankDocs); //

    double reRankWeight = localParams.getDouble("reRankWeight",2.0d);

    int start = params.getInt(CommonParams.START,0);
    int rows = params.getInt(CommonParams.ROWS,10);
    int length = start+rows;
    return new ReRankQuery(reRankQuery, reRankDocs, reRankWeight, length, scale);
}
 
Example 2
Source File: MyParser.java    From solr-custom-score with Apache License 2.0 5 votes vote down vote up
public MyParser(List<String> pfield,String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req) {
    super(qstr, localParams, params, req);
    try {
        QParser parser = getParser(qstr, "lucene", getReq());
        this.innerQuery = parser.parse();
    } catch (SyntaxError ex) {
        throw new RuntimeException("error parsing query", ex);
    }
    this.params=pfield;
}
 
Example 3
Source File: TestXJoinQParserPlugin.java    From BioSolr with Apache License 2.0 5 votes vote down vote up
private static Query parse(String v) throws SyntaxError {
  ModifiableSolrParams localParams = new ModifiableSolrParams();
  localParams.add(QueryParsing.V, v);
  QParserPlugin qpp = core.getQueryPlugin(PARSER_NAME);
  QParser qp = qpp.createParser(null, localParams, null, req);
  return qp.parse();
}
 
Example 4
Source File: TestXJoinQParserPlugin.java    From BioSolr with Apache License 2.0 5 votes vote down vote up
private static Query parse(String v) throws SyntaxError {
  ModifiableSolrParams localParams = new ModifiableSolrParams();
  localParams.add(QueryParsing.V, v);
  QParserPlugin qpp = core.getQueryPlugin(PARSER_NAME);
  QParser qp = qpp.createParser(null, localParams, null, req);
  return qp.parse();
}
 
Example 5
Source File: TestXJoinQParserPlugin.java    From BioSolr with Apache License 2.0 5 votes vote down vote up
private static Query parse(String v) throws SyntaxError {
  ModifiableSolrParams localParams = new ModifiableSolrParams();
  localParams.add(QueryParsing.V, v);
  QParserPlugin qpp = core.getQueryPlugin(PARSER_NAME);
  QParser qp = qpp.createParser(null, localParams, null, req);
  return qp.parse();
}