Comments (9)
Thank you, I see my error now.
I thought the function operated on each record individually rather than receiving an array of all the records.
That makes a lot more sense.
from firestore-algolia-search.
Sorry for explaining wrong, I think it makes sense as a feature request!
from firestore-algolia-search.
Thanks for your help @Haroenv
I got there in the end. I spent a lot of time trying to apply the API configuration when it was the was the Configure component I really needed.
<Configure facetFilters={[["isPublished:true"]]} />
👍
from firestore-algolia-search.
What do you return from the transform function? This plugin reads .result
of the response of the function. If you don't want to keep any, if I understand it correctly that response should be { result: [] }
firestore-algolia-search/functions/src/transform.ts
Lines 25 to 31 in f29a83e
from firestore-algolia-search.
I'll close this issue now, but if you have further questions, feel free to ask!
from firestore-algolia-search.
OK, so having looked at this further it appears the transform function is applied to each individual record as described in the ReadMe.
(My biggest problem was actually that my function was in Europe-West-1 not Europe-West-2 and that returned the JSON error. Whoops.)
What I want to do is this:
import * as functions from "firebase-functions";
const searchIndexing = functions
.region("europe-west2")
.https.onCall((record: any, context) => {
if (record.isPublished) {
return record;
} else {
// Do not index this record or remove if it is already present
return;
}
});
Having looked at the extension it looks like this is not possible at the moment as the transform function is applied after the decision to Create or Delete from Algolia.
Is there a better way to do this or should this be a feature request?
from firestore-algolia-search.
Hello @Bones5
Algolia Search configuration provides a way to filter your search results by using filtering or Query rules. I would recommend this approach. I am hesitant to add code for this use case. Also, I would also suggest not sending attributes in the search results that might not be relevant in the search experience, https://www.algolia.com/doc/api-reference/api-parameters/unretrievableAttributes/.
Let me know if you have any questions.
Sajid
from firestore-algolia-search.
Thanks for your reply @smomin
It does look like this is typically done in Algolia. It is similar to an "inStock" for something like Shopify.
Looking at this example it is applied in at during the index https://www.algolia.com/doc/api-reference/api-parameters/numericFilters/#examples
I'm a bit confused how to replicate this using the plugin, do you know where I would add this search to the index?
from firestore-algolia-search.
If you have the "in stock" attribute as a key of the object/record, you can set it as attributesForFaceting
and use filters frontend to hide or display those: facetFilters: [['inStock:true']]
for example. You can also use InstantSearch' toggleRefinement or refinementList for making the UI
from firestore-algolia-search.
Related Issues (20)
- Subcollections fail the initial sync HOT 10
- Feature Request: disable debug logging (via configurable param?) HOT 1
- Error when installing algolia: "You may not have more than 32 total max instances in your project" HOT 1
- select firestore database HOT 8
- Bad performance backfilling large Firestore collections HOT 6
- Updated to mac Sonoma: issue with functions watching wrong directory HOT 3
- Allow for [ObjectId] Modification HOT 13
- Indexing large documents HOT 1
- Firestore "Extension" and >1 Collection HOT 3
- Firestore document changes not reflected in algolia index HOT 6
- Add correct guide example while doing configuration (Feature Request). HOT 1
- Node 16 deprecation HOT 2
- Prematurely Exiting Full Indexing HOT 4
- This extension overwrites the firestore objectID if one is manually set. HOT 2
- FirebaseFunctionsError: The principal lacks IAM permission "cloudtasks.tasks.create" HOT 2
- What's the right authentication setup for a transform Cloud Function endpoint? HOT 2
- multi-environment configuration (secrets) HOT 2
- Error trying to run fullIndex on > 250 documents HOT 28
- Firebase Transform Function not removing unwanted key from a field object HOT 2
- Extension cloud function to use transaction 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 firestore-algolia-search.