How can I search for multiple keywords in an array?

Hello. I am designing a job board website which consists of job_posts and users.

job_posts index has this array attribute in algolia:

skillsRequired: ['PHP', 'Javascript', 'C++']

Obviously every post has different values. I want to search algolia by providing a number of skillsRequired values and sort it based on the number of matching skills I provide.

There are 3 posts with the values:

    jobID: 1,
    skillsRequired: ['PHP', 'Python', 'Javascript']
    jobID: 2,
    skillsRequired: ['Javascript', 'PHP']
    jobID: 3,
    skillsRequired: ['MonggoDB']

Now I want to do a search:
Query #1: “PHP” and “Javascript” This should return jobID 2, and JobID 1 in order
Query #2: “PHP”, “Python” and “Javascript” should return JobID 1 and JobID 2 in order

Is this possible?

PS: Is it possible to provide an array of search terms instead of a complete string “php javascript python” ?

Hi there,

I guess you can look into Faceting.

I’m not sure in which environment you are working on but this example shows you how to use faceting for an attribute “brand” in InstantSearch.js.

Let me know how it goes!

Thanks for the response @eunjae.lee. I read the docs and it seems to only accept one string parameter

index.searchForFacetValues('Job_posts', 'PHP').then(({ facetHits }) => {

I want to be able to search a certain number of keywords eg: ‘PHP’ and ‘Javascript’. Im using the nodejs library, via firebase functions. Thanks a lot!

Update: It seems that I can do it by searching using facetFilters:

const index = client.initIndex('job_posts');'', {
    facets: [
    facetFilters: [

The above does work in my use case. However, if there are better approach please let me know

Hi @ansell

searchForFacetValues is to see what kind of facet values exist. So it’s not for this case.

What you did with facetFilters is the correct way.