How can I make the execution of a query in a subentity dependent on a field
value from the main entity?

So as you can see in the (simplified) data config below, there's an entity
`categories_lvl_0` which holds an expensive query. I ONLY want to execute
this query if: searchobject.objecttype=115

How can I configure this?

<dataConfig>
        <dataSource name="ds-sql"
driver="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://localhost:1433;databaseName=mydb" user="myuser"
password="mypwd" />
        
    <document name="searchobjects">
        <entity name="searchobject" pk="id" dataSource="ds-sql"
query="SELECT c.objecttype,c.id,c.title
FROM locations c
UNION
SELECT 115 as objecttype,c.id,c.title FROM products c">         

                        <field name="id" column="id" />
                        <field name="objecttype" column="objecttype" />
            <field name="title" column="title" />

                        
                        <entity name="categories_lvl_0" dataSource="ds-sql" 
query="SELECT slug_nl
as slug_nl_0,slug_en as slug_en_0,label_nl as label_nl_0,label_en as
label_en_0
                        FROM articlegroups ga WITH (NOLOCK)
                        INNER JOIN products_category_mapping pcm on 
pcm.articlegroup_id=ga.id
                        INNER JOIN products gp on gp.id=pcm.artikelid
                        WHERE gp.artikelnummer='${searchobject.id}' AND 
ga.catlevel=0">
                        </entity>                       

                        
        </entity>
                
                
    </document>
</dataConfig>



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

Reply via email to