-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using without ORM #164
Comments
Yes it is. You have to consider two things:
Example document: namespace Acme\DemoBundle\Entity;
use FS\SolrBundle\Doctrine\Annotation as Solr;
/**
* @Solr\Document(index="core0")
*/
class IndexOnlyDocument
{
/**
* @Solr\Id(generateId=true)
*/
protected $id;
/**
* @Solr\Field(type="string")
*/
protected $name;
} Querybuilder $query = $this->get('solr.client')->getQueryBuilder(IndexOnlyDocument::class)
->where('name_s')->is('1230000')
->getQuery();
$query->setHydrationMode(HydrationModes::HYDRATE_INDEX);
$result = $query->getResult(); |
This is my example query
and there is question about fields naming, i have
|
Your entity/model would look like this /**
* @Solr\Document()
*/
class TestDocument
{
/**
* @Solr\Id()
*/
protected $id;
/**
* @Solr\Field()
*/
protected $name;
} You can filter for Id like this: $query = $this->get('solr.client')->getQueryBuilder(TestDocument::class)
->where('id')->is('node_group_g482_de')
->getQuery();
$query->setHydrationMode(HydrationModes::HYDRATE_INDEX);
$result = $query->getResult(); |
problem that in query by 'name' property i have additional fq=id:document_*, but my id field have no prefix 'document_' |
Yes thats true. I have to revert my answer. It is only possible with hacks to query your index. But can can still use the solarium API to get results. |
Yep, but qb functionality so sweet. is it possible to add inside annotation parameter name, like in doctrine, to connect it with already exists fields in solr? |
No. The problem is not your field-mapping, is how the bundle filters documents for a given entity/model query. |
But does it make sense to handle this situation with bundle(make fork?) of try to switch to some custom solution? What is your advice? |
It think it is not necessary to fork this bundle. You have to overwrite the behavior in https://github.com/floriansemm/SolrBundle/blob/1.6.x/Query/SolrQuery.php#L174. This means you need a new |
I've faced the same problem. After I've updated this bundle from the 1.5 version to 1.6, my application stopped to response correct data, because of this filter. |
Hello, is it possible to use this bundle without Doctrine, and use simple class with annotation for mapping, coz data already exist in solr and handled without any ORM? i want to use query builder, but don't want to duplicate data in mysql.
The text was updated successfully, but these errors were encountered: