[ 
https://issues.apache.org/jira/browse/SOLR-1795?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jan Høydahl closed SOLR-1795.
-----------------------------
    Resolution: Won't Fix

Closing ancient issue as won't fix. A better way to pull results from a DB 
would be through streaming expressions these days.

> Subclassing QueryComponent for fetching results from a database
> ---------------------------------------------------------------
>
>                 Key: SOLR-1795
>                 URL: https://issues.apache.org/jira/browse/SOLR-1795
>             Project: Solr
>          Issue Type: Improvement
>          Components: SearchComponents - other
>    Affects Versions: 1.4
>            Reporter: Dallan Quass
>            Priority: Minor
>
> This is a request to change the access on a few fields from package to public.
> I've subclassed QueryComponent to allow me to fetch results from a database 
> (based upon the stored uniqueKey field) instead of from the shards. The only 
> stored field in solr is the uniqueKey field, and whatever fields I might need 
> for sorting.  To do this I've overridden QueryComponent.finishStage so that 
> after executing the query, SolrDocuments are created with the uniqueKey 
> field.  A later component populates the rest of the fields in the documents 
> by reading them from a database.
> {code}
> public void finishStage(ResponseBuilder rb) {
>    if (rb.stage == ResponseBuilder.STAGE_EXECUTE_QUERY) {
>       // Create SolrDocument's from the ShardDoc's
>       boolean returnScores = (rb.getFieldFlags() & 
> SolrIndexSearcher.GET_SCORES) != 0;
>       for (ShardDoc sdoc : rb.resultIds.values()) {
>          SolrDocument doc = new SolrDocument();
>          doc.setField("id", sdoc.id);
>          if (returnScores && sdoc.score != null) {
>             doc.setField("score", sdoc.score);
>          }
>          rb._responseDocs.set(sdoc.positionInResponse, doc);
>       }
>    }
> }
> {code}
> Everything works fine, but ResponseBuilder variables: *resultIds* and 
> *_responseDocs*, and ShardDoc variables: *id*, *score*, and 
> *positionInResponse* currently all have package visibility.  I needed to 
> modify the core solr files to change their visibility to public so that I 
> could access them in the function above. Is there any chance that they could 
> be changed to public in a future version of Solr, or somehow make them 
> accessible outside the package?
> If people are interested, I could post the QueryComponent subclass and 
> database component that I wrote. But it gets a bit involved because the 
> QueryComponent subclass also handles parsing the query just at the main solr 
> server, and sending serialized parsed queries to the shards.  (Query parsing 
> in my environment is pretty cpu- and memory-intensive so I do it just at the 
> main server instead of the shards.)



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to