venveo / craft-documentsearch

Automatically extract keywords from documents in Craft CMS and inject them into the search index
Other
6 stars 2 forks source link

Extracting keywords to be used elsewhere? #13

Closed mofman closed 1 year ago

mofman commented 1 year ago

We're using Algolia along with https://github.com/studioespresso/craft-scout to index our site. Wondering if there is an ability to extract the keywords for indexing elsewhere?

Thanks

Mosnar commented 1 year ago

@mofman You should be able to access the extracted keywords by accessing the property contentKeywords off of an asset. For example:

{% set keywords = craft.assets.kind('pdf').one().contentKeywords %}

Keep in mind, this will trigger the document to be downloaded and rescanned. If you wanted to keep the existing saved keywords, you'd need to query the search index table manually, which might not be the best idea.

mofman commented 1 year ago

@Mosnar thanks for the response, yes both these idea seem ideal, I'll have to experiment to see which is appropriate for our use case.