I am extremely new to SOLR and am wondering if it is possible to do something 
like the following. Basically I have been tasked with researching SOLR to see 
if we can replace our current searching algorithm.
We have a website with product data.  Product data includes standard things 
like Name, SKU, Description, StandardPrice and other things.  I can search that 
information with no issue, however in addition to the product data, the Price 
of the product can depend on the user that is logged in and doing the 
searching.  So, for one user, the product costs $2.50 and for another the same 
product costs $2.65.  Additionally a user might not have a price specifically 
for them, so we would display the standard price of for the product which might 
be $2.75.  The tables in the database look similar to this:
ProductProductIDNameSKUDescriptionStandardPrice

ProductUserPriceProductIDUserIDPrice

How can I create the SOLR installation so that when searching for products, I 
return the product information, including the correct Price for the logged in 
user?  We will know the UserID when searching, so that can be part of the 
query.  Also, part of the search might be for all products in a certain price 
range ($.50 - $10.00) which should take into account the price for the specific 
user.
I have started using the DataImporter and have come up with this 
design:<document>
    <entity name="product"  
      pk="productid"
      query="select 
      productid as id
    , ProductName
    , ProductDescription
    , StandardPrice 
from product"
      deltaImportQuery=""
      deltaQuery=""
      >
       <field column="id" name="id"/>
       <field column="ProductName" name="ProductName"/>    
       <field column="ProductDescription" name="ProductDescription"/> 
        <field column="StandardPrice" name="StandardPrice"/>
       <entity child='true' name='CHILD' query="select ProductID as id, UserID, 
Price from ProductUserPrice where productid = '${PARENT.id}'">
          <field column='id' />
          <field column='UserID' />
          <field column='Price' />
      </entity>
    </entity>
</document>

I can use this to import Parent information, but I have no idea how to use the 
Child entity.  I don't see how to handle nested docs in the schema.xml.  Is it 
possible to do so?

I would appreciate any help, and if there is another way to solve this beyond 
nested documents I am completely open to a different way. 

Thank You!
Brian

Reply via email to