Algolia: What happens if I import records, that have different properties, into an index? -
for example, if send recordone property "color" property "price". second record in set, recordtwo, has property "price" not property "color".
what happens both records indexed :)
indices schemaless, have no obligation push records identical attributes same index.
it have consequences though, depending on index configuration.
if index attributestoindex
parameter includes color
attribute, recordone record searchable using attribute, whereas recordtwo record won't.
the engine ignore missing attributes on objects , use what's available. let's have index containing 2 objects:
[{ "objectid": "recordone", "name": "colorful object", "color": "green", "price": 19.99 }, { "objectid": "recordtwo", "name": "colorless object", "price": 25 }]
with attributestoindex = ['name', 'color']
... , perform search query "green".
only recordone returned 'green' matched in color
attribute.
if query "object", both records returned word present in both records in name
property.
you can test in algolia's dashboard!
- create new index
- use "add manually" button add both records (just copy json above)
- add
name
,color
attributes index settings in "ranking" tab - go "browse" tab , try queries there :)
Comments
Post a Comment