Giter Club home page Giter Club logo

Comments (6)

bcartier avatar bcartier commented on August 30, 2024 1

Thanks for looking into it. Maybe there's something wrong in my configuration? Here is my config where I have a collection named "naics_2017_examples_en", and it has text fields "example" and "exceptions". The "naics" field is a o2m relationship field (and populates the index with the foreign key):

{
	"server": {
		"type": "algolia",
	    "appId": "*********",
	    "key": "********************"
	},
	"batchLimit": 100,
	"reindexOnStart": false,
	"collections": {
	
		"naics_2017_examples_en": {
		
			"indexName": "naics_2017_examples_en_test",
	

			"filter": {
				"status": "published"
			},
			"fields": ["example",  "exceptions", "naics"]
		}
	}
}

.... and here is the Algolia index. This one index entry gets overwritten for every item in the collection when I run "npx directus extension:searchsync index" (the exceptions field is supposed to be blank in this example):

{
  "example": "fruit cocktail, canned, manufacturing",
  "exceptions": "",
  "naics": "311420",
  "objectID": "undefined"
}

from directus-extension-searchsync.

dimitrov-adrian avatar dimitrov-adrian commented on August 30, 2024

What is the name of the Primary Key field?

from directus-extension-searchsync.

bcartier avatar bcartier commented on August 30, 2024

I rolled back to how I had it configured when is was working for me (using a json config file). Basically, from what I now understand, the extension determines the primary key of the configured collection, and passes that value to Algolia as the objectID. This no longer happens. I wonder if something changed in the latest versions of Directus that changes how you determine the primary key for a collection. Maybe this line on create-indexer.js (line 69) no longer works?

const pk = schema.collections[collection].primary;

In my use case, the primary key of the collection I'm trying to index is "id"

from directus-extension-searchsync.

dimitrov-adrian avatar dimitrov-adrian commented on August 30, 2024

Doesn't looks as there, at least with my tests it get correct primary key name, and pass correctly to the request. I also make different tests with algolia with different primary key names, and all seems to works for me, so cannot reproduce.

Anyway, I'll continue to dig on it.

from directus-extension-searchsync.

dimitrov-adrian avatar dimitrov-adrian commented on August 30, 2024

I think it should be fixed now. The issue indeed was with the missing id field passing to algolia indexer when using filter fields.

Thanks for all the report!

from directus-extension-searchsync.

bcartier avatar bcartier commented on August 30, 2024

Thanks so much for your help!

from directus-extension-searchsync.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.