Frage

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)

War es hilfreich?

Lösung

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top