Thanks Ahmet. There are couple reasons we couldn't index those fields:
1. pricing logic is complex and must be done in ERP.
2. price requires real-time update if indexed
3. those fields could be changed frequently, for example inventory, while we 
try to minimize index update because we have a huge index (denomolized from ~2 
billion RDMS records)

I had a quick look at the link you sent but still don't understand how it could 
be used in our problem. The main problem we have now is how to add extra fields 
(not in the index) at query time, not to get those fields from ERP.

Thanks,

-Ha
-----Original Message-----
From: Ahmet Arslan [mailto:iori...@yahoo.com.INVALID] 
Sent: Saturday, April 11, 2015 12:38 AM
To: solr-user@lucene.apache.org
Subject: Re: Enrich search results with external data

Hi,

Who don't you include/add/index those additional fields, at least the one used 
in sorting?

Also, you may find https://stanbol.apache.org/docs/trunk/components/enhancer/ 
relevant.

Ahmet



On Saturday, April 11, 2015 1:04 AM, "ha.p...@arvatosystems.com" 
<ha.p...@arvatosystems.com> wrote:
This ticket seems to address the problem I have

https://issues.apache.org/jira/browse/SOLR-1566



and as the result of that ticket, DocTransformer is added since Solr 4.0. I 
wrote a simple DocTransformer and found that the transformer is executed AFTER 
pagination. In our application, we need the external fields added before 
sorting/pagination. I've looked around for the option to change the execution 
order but haven't had any luck. Does anyone know the solution?



The ticket also states "it is not possible for components to add fields to 
outgoing documents which are not in the stored fields of the document". Does 
anyone know if this is still true?



Thanks,



-Ha





-----Original Message-----

From: Pham, Ha

Sent: Thursday, April 09, 2015 11:41 PM

To: solr-user@lucene.apache.org


Subject: Enrich search results with external data



Hi everyone,



We have a requirement to append external data (e.g. price/inventory of product, 
retrieved from an ERP via web services) to query result and support sorting and 
pagination based on those external fields. For example if Solr returns 100 
records and the page size user selects is 20, the sorting on the external  
fields is still on 100 records. This limits us from enriching search results 
outside of Solr. I guess this is a common problem so hopefully someone could 
share their experience.



I am considering using a PostFilter and enrich documents in collect() method as 
below



@Override

public void collect(int docId) throws IOException { DoubleField price = new 
DoubleField ("PRICE", 1.23, Field.Store.YES); Document currentDoc = 
context.reader().document(docId); currentDoc.add(price); }



but the result documents don't have PRICE fields. Did I miss anything here?



I also did some research and it seems the approach mentioned here 
http://sujitpal.blogspot.com/2011/05/custom-sorting-in-solr-using-external.html 
is close to what we need to achieve but since the document is 4 years old, I 
don't know if there's a better approach for our problem (we are using solr 5.0)?



Thanks,



-Ha

Reply via email to