lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bsr <birender.ra...@gmail.com>
Subject Solt with no text search
Date Sat, 24 Feb 2018 13:13:53 GMT
 0
down vote
favorite
	

I have successfuly implemented the custom search in solr by extending
CustomScoreProvider. But the problem is i need to pass some user info like
31,1 which i need in custom sort.

q={!mycustomparser}31+1+*:*

and it is acting as a text search. Is there any way that i can skip this
text search and can just pass the user info.

some code.

public class MyCustomParserPlugin extends QParserPlugin {

    @Override
    public QParser createParser(String querystring, SolrParams slocParams,
SolrParams params, SolrQueryRequest req) {
        return new MyCustomParser(querystring, slocParams, params, req);        
    }

    private static class MyCustomParser extends QParser{

        private Query inQuery;

        public MyCustomParser(String querystring, SolrParams slocParams,
SolrParams params, SolrQueryRequest req) {
            super(querystring, slocParams, params, req);
            try {
                QParser parser = getParser(querystring, getReq());
                this.inQuery = parser.parse();
            }catch(SyntaxError ex) {
                throw new RuntimeException("error parsing query", ex);
            }
        }

        @Override
        public Query parse() throws SyntaxError {
            return new MatchingQuery(inQuery);
        }

    }

}

=========================================

public class MatchingQuery extends CustomScoreQuery {

    private Query subQuery;

    public MatchingQuery(Query subQuery) {
        super(subQuery);
        this.subQuery = subQuery;
    }

    @Override
    protected CustomScoreProvider getCustomScoreProvider(LeafReaderContext
context) {
        return new MyCustomSortClz(subQuery, context);
    }
}

=========================================

public class MyCustomSortClz extends CustomScoreProvider {

  // ---> my sort
}





--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Mime
View raw message