Hi, what is the easiest way to get intersected dat...
# community-help
j
Hi, what is the easiest way to get intersected data? For example, I query "angular rxjs", then I would expect to get records that have both in my data, but it returns an empty array. If I query it separately then it's ok (they have both keywords in texts). My code is simple like this below.
Copy code
const result = await this.typesenseService.getClient()
      .collections('job-offers')
      .documents()
      .search({
        q: search || '*',
        query_by: 'description,technologies,title,company',
        query_by_weights: '8,6,4,4',
        per_page: pageSize,
        filter_by: filterString,
        sort_by: sortBy,
        page: page + 1,
      });
a
Hey Jakub, The query without double quotes should return documents with either words. With doubles quotes will only find documents with these exact words in that exact order. Could you share the curl requests that this performs?
j
@Alan Martini you mean like this?
Copy code
curl -X GET "<url-cloud>/job-offers/documents/search?q=angular%20rxjs&query_by=description,technologies,title,company&query_by_weights=8,6,4,4&per_page=20&filter_by=posted_time:>1751834876434&sort_by=posted_time:desc&page=1" \ -H "X-TYPESENSE-API-KEY: keyyyy"
My issue is like this: I have description with both these keywords "angular" and "rxjs" and I would just return it if it occurs in text. Is that possible?
image.png,image.png
a
Hey Jakub, Could you create a minimal reproducible example using the script below as reference? gist.github.com/auth/github?return_to=https%3A%2F%2Fgist.github.com%2Fjasonbosco%2F7c3432713216c378472f13e72246f46b
j
@Alan Martini I think I solved it. the issue was space " " in symbols to index (im testing now with + and # only and it works good). the code that didn't work yesterday:
Copy code
await this.typesenseService.getClient().collections().create({
        name: collectionName,
        fields: [
          { name: 'id', type: 'string'  },
          { name: 'title', type: 'string' },
          { name: 'company', type: 'string' },
          { name: 'description', type: 'string' },
          { name: 'fajne_podsumowanie', type: 'string' },
          { name: 'fajny_tytul', type: 'string' },
          { name: 'locations', type: 'string[]', facet: true },
          { name: 'technologies', type: 'string[]', facet: true },
          { name: 'experience', type: 'string[]', facet: true },
          { name: 'employment_types', type: 'string[]', facet: true },
          { name: 'employment', type: 'string[]', facet: true },
          { name: 'operating_mode', type: 'string[]', facet: true },
          { name: 'page_type', type: 'string', facet: true },
          { name: 'gradient', type: 'string' },
          { name: 'angular_developer', type: 'bool', facet: true },
          { name: 'react_developer', type: 'bool', facet: true },
          { name: 'java_developer', type: 'bool', facet: true },
          { name: 'python_developer', type: 'bool', facet: true },
          { name: 'junior_or_intern', type: 'bool', facet: true },
          { name: 'salary_top', type: 'int32' },
          { name: 'salary_bottom', type: 'int32' },
          { name: 'posted_time', type: 'int64', facet: true }
        ],
        symbols_to_index: ['+', '#', '.', '-', ' ', '/', '\\', '_'],
        default_sorting_field: 'posted_time'
      });
a
Ah, nice catch! Yes, if you declare in symbols to index, it won't interpret as two different tokens.
j
@Alan Martini im newbie with this. so in simple words putting there a space is useless almost always right?
a
Yeah, the use case will be very niched.
🙌 1