Closed mrmadhav closed 8 years ago
it is not possible to search for multiple entities
Hi @floriansemm,
Thanks for your response. I have since then created a fork of the repository to do just that, i.e. query multiple documents at the same time.
You can find the fork here: https://github.com/mrmadhav/SolrBundle
Please let me know if this would be interesting to integrate into the main codebase or if you would want me to improve things beforehand ?
Best Regards, Madhav
Thanks! Great work.
The idea behind queries is to create query-string which results in a set of hydrated objects from the same type. So the whole query thing in this bundle is based on doctrine-queries.
It is already possible to query multiple documents. The result is a set of documents, not entities.
$selectQuery = $this->get('solr.client.adapter')->createSelect();
// queries all documents with field `text`
$selectQuery->setQuery('text_t:relation');
$result = $this->get('solr.client.adapter')->select($selectQuery, 'core1');
foreach ($result as $document) {
echo '<hr/><table>';
// the documents are also iterable, to get all fields
foreach ($document as $field => $value) {
// this converts multivalue fields to a comma-separated string
if (is_array($value)) {
$value = implode(', ', $value);
}
echo '<tr><th>' . $field . '</th><td>' . $value . '</td></tr>';
}
echo '</table>';
}
Thanks ! I'll try this format also to see if it is better in terms of performance...
Best Regards, Madhav
Hi,
Does this bundle allow the ability to search for results from multiple Entities and get the result in order of relevance ?
E.G.
The reason I was thinking of going this way was that since my Entities have a lot of relationships, then creating a view to handle all the joins would result in an extremely long and unmanageable query.
Thanks Madhav