Open teohhanhui opened 8 years ago
sorry, can you elaborate?
Using the example in the README:
class Article
{
/**
* @var string
* @Column(name="title", type="string", nullable=false)
*/
private $title;
/**
* @TsVector(name="title_fts", fields={"title"})
*/
private $titleFTS;
/**
* @var string
* @Column(name="body", type="text", nullable=true)
*/
private $body;
/**
* @TsVector(name="body_fts", fields={"body"})
*/
private $bodyFTS;
/**
* @TsVector(name="title_and_body_fts", fields={"title", "body"})
*/
private $titleAndBodyFTS;
}
We can never do the query against title_and_body_fts
with the current design.
tsquery(a.title, :searchQuery)
would use title_fts
, and tsquery(a.body, :searchQuery)
would use body_fts
.
I propose removing the text field -> tsvector field
rewriting magic in the query.
The first tsvector field that contains the field is used: https://github.com/jaimz22/DoctrineFullTextPostrgres/blob/86bca023c972d0f08988c3c912bb6d4c77c400bf/src/ORM/Query/AST/Functions/TSFunction.php#L59-L62
To fix this, we have to allow the user to directly specify the tsvector field to use, instead of using the underlying field in the query.
Example: