Comments (10)
Are you sure you're using the correct section handle and that they're all published?
from craft-scout.
Yes, this code gives me all articles for the same section:
{% set entries = craft.entries.section('cityPlanningArticles').all() %}
from craft-scout.
I cannot seem to reproduce this, it must be something with the section you defined, could you post a screenshot of the section settings and the content? Maybe I can find something wrong with them then.
from craft-scout.
What content do you mean?
from craft-scout.
I've just tried everything with the same settings and it works for me.
Does this return something when you try it from a module or plugin?
\craft\elements\Entry::find()->section('cityPlanningArticles')->all();
this is what Scout runs in the background to find the entries.
from craft-scout.
It does.
from craft-scout.
This is the query... returns zero elements.
(
[editable] =>
[sectionId] => Array
(
[0] => 1
)
[typeId] =>
[authorId] =>
[authorGroupId] =>
[postDate] =>
[before] =>
[after] =>
[expiryDate] =>
[defaultOrderBy:protected] => Array
(
[entries.postDate] => 3
)
[elementType] => craft\elements\Entry
[query] =>
[subQuery] =>
[contentTable] => {{%content}}
[customFields] =>
[inReverse] =>
[asArray] =>
[id] =>
[uid] =>
[fixedOrder] =>
[status] => Array
(
[0] => live
)
[archived] =>
[dateCreated] =>
[dateUpdated] =>
[siteId] =>
[enabledForSite] => 1
[relatedTo] =>
[title] =>
[slug] =>
[uri] =>
[search] =>
[ref] =>
[with] =>
[orderBy] =>
[withStructure] => 1
[structureId] =>
[level] =>
[ancestorOf] =>
[ancestorDist] =>
[descendantOf] =>
[descendantDist] =>
[siblingOf] =>
[prevSiblingOf] =>
[nextSiblingOf] =>
[positionedBefore] =>
[positionedAfter] =>
[_result:craft\elements\db\ElementQuery:private] =>
[_resultCriteria:craft\elements\db\ElementQuery:private] =>
[_searchScores:craft\elements\db\ElementQuery:private] =>
[select] => Array
(
[0] => **
)
[selectOption] =>
[distinct] =>
[from] =>
[groupBy] =>
[join] =>
[having] =>
[union] =>
[params] => Array
(
)
[queryCacheDuration] =>
[queryCacheDependency] =>
[_events:yii\base\Component:private] => Array
(
)
[_eventWildcards:yii\base\Component:private] => Array
(
)
[_behaviors:yii\base\Component:private] => Array
(
[customFields] => craft\behaviors\ElementQueryBehavior Object
(
[altText] =>
[article] =>
[articleFeedbackEmail] =>
[attribution] =>
[description] =>
[files] =>
[filteredMatrixContent] =>
[flowContent] =>
[image] =>
[images] =>
[imageText] =>
[linkText] =>
[linkUrl] =>
[logo] =>
[mainArticle] =>
[mainImages] =>
[mainQuote] =>
[matrixContent] =>
[month01] =>
[month02] =>
[month03] =>
[month04] =>
[month05] =>
[month06] =>
[month07] =>
[month08] =>
[month09] =>
[month10] =>
[month11] =>
[month12] =>
[pageTitle] =>
[prioritized] =>
[projectTitle] =>
[quote] =>
[quoteArticle] =>
[relatedServices] =>
[richTextField] =>
[seo] =>
[snippet] =>
[source] =>
[subLogoTextFirst] =>
[subLogoTextSecond] =>
[summary] =>
[tagBusiness] =>
[tagEditorial] =>
[tagSubject] =>
[targetMethodNew] =>
[targetText] =>
[targetUrl] =>
[text] =>
[textAuthor] =>
[textForMainPage] =>
[textTitle] =>
[transcription] =>
[urlForMainPage] =>
[vimeoLink] =>
[_customFieldValues:craft\behaviors\ContentBehavior:private] => Array
(
)
[owner] => craft\elements\db\EntryQuery Object
*RECURSION*
)
)
[where] =>
[limit] =>
[offset] =>
[indexBy] =>
[emulateExecution] =>
)
from craft-scout.
The only filter on there is sectionId => 1
and status => live
, I have no idea why it wouldn't return anything.
from craft-scout.
We are running a multi-site setup, and siteId 4 is the main site, but not where the articles of section "cityPlanningArticles" are located. Those are located in siteId 1 in our case... siteId must be determined by which site is enabled for a section I guess and that might not be whats happening here? If multiple sites are enabled for a section they should all be listed in the where part of the query?
Debugging the queryBuilder I found this:
(
[0] => and
[1] => Array
(
[0] => or
[1] => Array
(
[0] => =
[1] => entries.sectionId
[2] => 1
)
)
[2] => Array
(
[elements_sites.siteId] => 4
)
[3] => Array
(
[content.siteId] => 4
)
from craft-scout.
@larsboldt Ah, that makes sense, I think most use cases would call for seperate indexes for each site, so you could do the following in your mappings:
[
'indexName' => 'poc_magasin_1',
'elementType' => \craft\elements\Entry::class,
'criteria' => [
'section' => 'cityPlanningArticles',
'siteId' => 1
],
'transformer' => function (craft\base\Element $element) {
return $element->toArray();
},
],
[
'indexName' => 'poc_magasin_2',
'elementType' => \craft\elements\Entry::class,
'criteria' => [
'section' => 'cityPlanningArticles',
'siteId' => 2
],
'transformer' => function (craft\base\Element $element) {
return $element->toArray();
},
],
...
from craft-scout.
Related Issues (20)
- [STU-58] Indexing jobs sent to queue runner only run from primary site HOT 8
- Make it possible to set priority of IndexElement job HOT 4
- Clarify the license HOT 1
- [STU-51] Deprecation Warning: Disabling the queue option
- [STU-52] TypeError with getSiteById() on multi-site HOT 2
- Saving entry using queue runner only index the primary site version of the entry HOT 1
- Algolia not updated on save HOT 3
- [STU-65] Only one index shows in the control panel HOT 4
- [STU-85] Entry deindexing soft failing HOT 19
- IndexSettings not applied HOT 2
- [STU-74] Triggering an event after a successful refresh on queue jobs? HOT 6
- Type error with `siteId` in v3.3.1 HOT 3
- Getting an error related to $siteId having update to 3.3.1 from 3.2.1 HOT 2
- Support for package league/fractal 0.20.1 HOT 1
- Potential for Multiple Application IDs? HOT 7
- [4.1.0-beta.1] Queue Error When Saving an Entry When Using getElements HOT 8
- [5.0.0-beta1] Refreshing index or saving entry in section causes Memory allocation error: 1038 Out of sort memory HOT 10
- Unknown column 'purchasables_stores.hasUnlimitedStock' HOT 3
- Undefined array key error in SearchableBehavior.php when replicaIndex is true HOT 1
- ``One more question if I may, I've installed the Scout plugin (first via plugin manager and again via CLI) into Craft 5. I then went to Algolia and setup an index and then setup scout.php in my config directory (see attached), moved my keys to env, verified that my index shows up under utilities/Scout Indices (shows 2 elements in Craft and 0 Records), but no Scout commands are working (i.e. - ddev craft scout/index/import 'my_index'). All commands fail to run with exit_status 1. The logs on Algolia don't seem helpful. They only show error status codes 200.
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 craft-scout.