Question

I have defined many entities in solr. For example,

<document name="content">
    <entity name="post" query="SELECT * FROM post">
            // field mappings
        </entity>
        <entity name="category" query="select * from category " >
           // field mappings    
        </entity>
</document>

I'm using solrj to perform searching tasks. When searching a keyword, for instance 'facebook', both post and category containing the keyword 'facebook' so solr returns data of post and category. But how can I know which data belong to post and which ones belong to category entity? (I use solr 4.x)

Était-ce utile?

La solution

Better keep a common field (say "entity") in both type of Solr doc. Store the entity name for each one. When you query, by the entity value, you'll know the result belongs to which entity.

E.g For entity "post" keep entity:post

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top