Comments (13)
I think all you'll need to do is update that one line referenced in #239 to fix it there, the same fix is needed in #240 but you also need to replace DataObject::singleton()
as the singleton method is not in SilverStripe 3.x :). Hope that helps :)
from silverstripe-fulltextsearch.
Even with the updates the test getting the list of dirty IDs for has_many is failing. Will try to look into it more.
from silverstripe-fulltextsearch.
I think it does need to be fixed in fulltextsearch. That parameter is required in some cases.
from silverstripe-fulltextsearch.
If Translatable
's signature is $dataQuery = null
then it really shouldn't blindly expect an object...
@tractorcow how should we obtain a valid DataQuery
in SearchIndex::getDirtyIDs()
seeing as it doesn't seem to be using the ORM at all...
from silverstripe-fulltextsearch.
It's more = null
for legacy reasons, that is we couldn't change the method signature. We should have in 4.0 though to make it mandatory.
It should always provide it though; Versioned relies on it for example.
hm
$sql = new SQLSelect('"ID"', '"'.$tableName.'"', '"'.$step['foreignkey'].'" IN ('.implode(',', $ids).')');
singleton($step['class'])->extend('augmentSQL', $sql);
$ids = $sql->execute()->column();
Should probably be:
$ids = DataObject::get($step['class'])
->filter($step['foreignkey'], $ids)
->column('ID');
Not sure why it's written in such a convoluted way.
Similarly for the other relations... stop trying to do raw-sql, and just use the ORM the way it's meant to be called?
from silverstripe-fulltextsearch.
Had a guess at how the code would look all up:
foreach ($derivation['chain'] as $step) {
if ($step['through'] == 'has_one') {
$ids = DataObject::get($step['class'])
->filter($step['foreignkey'], $ids)
->column('ID');
} elseif ($step['through'] == 'has_many') {
// Get many ids by querying component with alternate set of foreign ids
$ids = DataObject::singleton($step['otherclass'])
->getComponents($step['method'], $ids)
->column('ID');
}
if (empty($ids)) {
break;
}
}
This makes use of the fact that you can mock a HasManyList with a set of foreign $id keys (instead of a single parent id).
Good thing I added that second arg to getComponents() :)
from silverstripe-fulltextsearch.
Affecting MBIE on a CWP project using 2.1 recipe
from silverstripe-fulltextsearch.
This also seems to affect Versioned objects as well in at least SilverStripe 4.3.0, Versioned requires a DataQuery as the second argument even though it's defined as accepting null as a parameter (see here).
from silverstripe-fulltextsearch.
The proposed PR works for us on the project, just need to sort the tests. Will try looking at it ASAP.
from silverstripe-fulltextsearch.
Back on this again, only 4 years after the initial report.
from silverstripe-fulltextsearch.
@michalkleiner I haven't used SOLR for a few years, but revisiting, I think the code example I pasted above should still fix the issue. I suggest throwing it into a PR and testing it out on a few live SOLR indexes to see if it works.
from silverstripe-fulltextsearch.
@tractorcow it works for us on a project, yes.
So you reckon it's rather about the failing test that might need adjusting?
from silverstripe-fulltextsearch.
Phew, ok, two new PRs with the tests passing and using the simplified DataObject::get
approach.
from silverstripe-fulltextsearch.
Related Issues (20)
- Filters are not escaped HOT 2
- Variant state not reset during processing. HOT 3
- Results not showing after editing pages (no soft-commit nor core reload issued) HOT 10
- Test and merge "allow update processor to be overridden by existing yml"
- Works fine on Dev, but on Prod many index files are missing and all owned by root (same database)
- Solr now at version 8 HOT 1
- Migrate to new Symfony cache classes HOT 5
- `SearchableService::isSearchable` incorrectly assumes return type of `canView` HOT 2
- Solr_Reindex build task doesn't work in dev mode in 3.9.0 HOT 4
- Allowing Symfony 3.2 or 4 can break reindexing HOT 10
- Stage param not being passed to Symfony
- 4.11.0-beta1 PHP 8.1 - Deprecation issue in solr-php-client HOT 1
- 4.11.0-beta2 PHP 8.1 - Changes in content are not reflected in search results HOT 7
- SearchIndex::fieldData is inefficient
- RFC: Search index update/new searcher on auto commit HOT 10
- 4.12 regression: Elemental block content not showing on search summary HOT 8
- `SearchVariant` replaced by `Injector` not consistent when used as part of `_documentid` HOT 1
- Deprecated code PHP 8.2 HOT 2
- New model field added to index, but doesn't appear in Solr HOT 1
- Add belongs_many_many support to search field scaffolding HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from silverstripe-fulltextsearch.