Add a custom parameter to Solr while using Spring Data Solr -


is possible add additional parameter solr query using spring data solr generates following request?

"params": {   "indent": "true",   "q": "*.*",   "_": "1430295713114",   "wt": "java",   "authenticatedusername": "user@domain.com" } 

i want add parameter needed apache manifoldcf, authenticatedusername , value, alongside other ones automatically populated spring data solr (q, wt).

thank you, v.

i managed make work looking @ source code of solrtemplate class wondering if there less intrusive solution.

public page<document> searchdocuments(documentsearchcriteria criteria, pageable page) {     string[] words = criteria.gettitle().split(" ");     criteria conditions = createsearchconditions(words);     simplequery query = new simplequery(conditions);     query.setpagerequest(page);     solrquery solrquery = queryparsers.getforclass(query.getclass()).constructsolrquery(query);     solrquery.add(authenticated_user_name, criteria.getloggedusername());     try {         string querystring = this.queryparsers.getforclass(query.getclass()).getquerystring(query);         solrquery.set(commonparams.q, querystring);         queryresponse response = solrtemplate.getsolrserver().query(solrquery);          list<document> beans = convertqueryresponsetobeans(response, document.class);         solrdocumentlist results = response.getresults();          return new solrresultpage<>(beans, query.getpagerequest(), results.getnumfound(), results.getmaxscore());     } catch (solrserverexception e) {         log.error(e.getmessage(), e);         return new solrresultpage<>(collections.<document>emptylist());     } }  private  <t> list<t> convertqueryresponsetobeans(queryresponse response, class<t> targetclass) {     return response != null ? convertsolrdocumentlisttobeans(response.getresults(), targetclass) : collections             .<t> emptylist(); }  public <t> list<t> convertsolrdocumentlisttobeans(solrdocumentlist documents, class<t> targetclass) {     if (documents == null) {         return collections.emptylist();     }     return solrtemplate.getconverter().read(documents, targetclass); }  private criteria createsearchconditions(string[] words) {     return new criteria("title").contains(words)             .or(new criteria("description").contains(words))                     .or(new criteria("content").contains(words))                     .or(new criteria("resourcename").contains(words)); } 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -