Add Open Graph Meta for crawling and JSON results
See original GitHub issueIssue Description
Hello,
I try to add Open Graph Meta inside my JSON results, my goal is to build a custom page based on the FESS JSON search to display the results with these fields by results :
- Title (based on <meta property=“og:title”)
- Description (based on <meta property=“og:description”)
- Thumbnail (based on <meta property=“og:image”)
- Url (based on <meta property=“og:url”)
I try to add it on doc.json like this :
"og:title": { "type": "keyword" }, "og:description": { "type": "keyword" }, "og:image": { "type": "keyword" }, "og:url": { "type": "keyword" }
And add it inside fess_config.properties :
query.additional.response.fields=og:title,og:description,og:image,og:url query.additional.search.fields=og:title,og:description,og:image,og:url
On the extractor side :
<!-- Open Graph --> <postConstruct name="addFieldRule"> <arg>"og:title"</arg> <arg>"//META[@name='og:title']/@content"</arg> </postConstruct> <postConstruct name="addFieldRule"> <arg>"og:description"</arg> <arg>"//META[@name='og:description']/@content"</arg> </postConstruct> <postConstruct name="addFieldRule"> <arg>"og:image"</arg> <arg>"//META[@name='og:image']/@content"</arg> </postConstruct> <postConstruct name="addFieldRule"> <arg>"og:url"</arg> <arg>"//META[@name='og:url']/@content"</arg> </postConstruct>
I restart the web crawling, but my json response is steel the same http://localhost:8080/json?q=flying :
[ { "filetype": "...", "title": "...", "content_title": "...", "digest": "...", "host": "...", "content_length": "351497", "timestamp": "2018-05-02T08:51:08.722Z", "url_link": "...", "created": "2018-05-02T08:51:08.722Z", "site_path": "...", "doc_id": "cbbba5547af04318aadec0d2de49e2a5", "url": "https://...", "content_description": "...", "site": "...", "filename": "...", "boost": "1.0", "mimetype": "text/html" } ]
No attribute og:*
Any idea? Thanks by advance!
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (4 by maintainers)
Hello there,
Could you try it this way?
You can edit other “og” tags like this
To add a custom field(ex. og_title), steps is:
{"og_title": { "type": "keyword" }}
field.xpath.og_title=//META[@property='og:title']/@content