codemanas / cm-typesense-docs Goto Github PK
View Code? Open in Web Editor NEWDocumentation for Typesense Plugin
Documentation for Typesense Plugin
Currently when I do an exact match search, the post is found but it is contained inside its custom post type grouping, and that grouping does not change rank order. That post type is last in the "Post Types to Enable" list. Don't we think that the matching priority should be taken into account before the order of the Posts Types to Enable grouping?
Hello,
The bulk of the content on the site I'm working on is in ACF Flexible Content Layout fields on Posts and Pages.
I'm assuming I would have to add the schema for these fields for them to be indexed in search. I have roughly 20 layouts, each with its own subfields. What is the best way to include all of these fields in the schema?
Additionally, what are the options for type
in this fields
array:
'fields' => [
[ 'name' => 'post_content', 'type' => 'string' ],
[ 'name' => 'post_title', 'type' => 'string' ],
[ 'name' => 'post_type', 'type' => 'string' ],
[ 'name' => 'post_author', 'type' => 'string' ],
[ 'name' => 'comment_count', 'type' => 'int64' ],
[ 'name' => 'is_sticky', 'type' => 'int32' ],
[ 'name' => 'post_excerpt', 'type' => 'string' ],
[ 'name' => 'post_date', 'type' => 'string' ],
[ 'name' => 'post_id', 'type' => 'string' ],
[ 'name' => 'post_modified', 'type' => 'string' ],
[ 'name' => 'id', 'type' => 'string' ],
[ 'name' => 'permalink', 'type' => 'string' ],
[ 'name' => 'post_thumbnail', 'type' => 'string' ],
[ 'name' => 'genre', 'type' => 'string[]', 'facet' => true ]
],
// ...
Thanks!
Are there any events triggered in JavaScript that I can hook into? I have two things I'd like to achieve
Hello,
I'm not sure if I set up this correctly but I would like to have a facet that allows to search within the posts by publication date
So here under is what I did (I just kept one other facet as example (lcr_post_theme which is a custom taxonomy). It works, my lcr_post_theme facet and the slider, but the displayed value of the rangeSlider are unix timestamp, how can display maybe only the year, ofrbetter, the full date in a format like this: 2024-08-26
Here is the code, the settings and visual result...
Any help welcome !
add_filter('cm_typesense_schema', function ($schema, $name) {
if ($name == 'post') {
$schema['fields'][] = ['name' => 'lcr_post_theme', 'type' => 'string[]', 'optional' => true, 'facet' => true];
// add a date range filter
$schema['fields'][] = ['name' => 'publication_date', 'type' => 'int64', 'optional' => true, 'facet' => true];
}
return $schema;
}, 10, 2);
add_filter('cm_typesense_data_before_entry', function ($formatted_data, $raw_data, $object_id, $schema_name) {
if ($schema_name == 'post') {
// theme
$lcr_post_theme = [];
$terms = get_the_terms($object_id, 'lcr_post_theme');
if ($terms) {
foreach ($terms as $term) {
$lcr_post_theme[] = $term->name;
}
}
// date should be an int64
$formatted_data['publication_date'] = strtotime(get_the_date('Y-m-d', $object_id));
// $formatted_data['publication_date'] = get_the_date('Y-m-d', $object_id); // -> this creates an error while indexing
}
return $formatted_data;
}, 10, 4);
/** Add the genre option to available index list **/
add_filter('cm_typesense_available_index_types', function ($available_post_types) {
$available_post_types['lcr_post_theme'] = ['label' => 'Thèmes', 'value' => 'lcr_post_theme', 'type' => 'taxonomy'];
// not sure if this needed
$available_post_types['publication_date'] = ['label' => 'Date de publication', 'value' => 'publication_date', 'type' => 'date'];
return $available_post_types;
});
add_filter('cm_typesense_enabled_taxonomy_for_post_type', function ($taxonomies) {
$taxonomies[] = 'lcr_post_theme';
// not sure if this is needed as well
$taxonomies[] = 'publication_date';
return $taxonomies;
});
add_filter('cm_typesense_filter_type', function ($filterType, $filterName) {
if ($filterName == 'publication_date') {
$filterType = 'rangeSlider';
}
return $filterType;
}, 10, 2);
// add_filter('cm_typesense_search_facet_settings', function ($facet_settings, $facet) {
// if ($facet == 'publication_date') {
// I guess it is here that I may customize somethin gbut how ??
// }
// return $facet_settings;
// }, 10, 2);
The URL is constructed like {NODE URI}{PORT} which results in.
https://example.com/reverse-proxy/:443/health
Feature request : Allow use of Hierarchal menu for Instant Search :
https://www.algolia.com/doc/api-reference/widgets/hierarchical-menu/js/
The pros :
Allows user to show category - sub category filter system that would be useful for customers to get data.
The cons:
WordPress by default does not distinguish category levels. What does this mean ?
WordPress records Parent for a category but - it does not by default save which level a category is.
So for example a category - sub category system like Clothing > Men > T-shirts
Here, Clothing is level 1 - Men is level 2 - T shirts is level 3.
However the Categories are not stored in WordPress with these levels associated with them.
So when a post is indexed - these calculations need to be made , so we would have to get the highest parent of the category tree
For 3 or less levels this should be fine - BUT - for larger nesting of categories - this would be quite resource intensive.
A possible solution for now is to allow users to implement this system but with the warning of the associated risk.
I am of the opinion that since this could potentially crash / consume large resources in some use cases - it would not be a good idea to provide this as a configurable option on the product for now - rather we should provide code samples that allow this to be implemented.
Autocomplete does not currently have search results highlighting.
This is currently not available on Autocomplete
Whereas Algolia Autocomplete currently has support for this Algolia Autocomplete
Algoia autocomplete has default support for querying - we would need to adapt this for typesense. Maybe a feature to turn on or off highlighting for shortcode.
Hello, is it possible to achieve the subject?
Not sure if I've misconfigured something, but I've added a few additional post types - Podcasts, Videos. When I replace the WordPress search with Autocomplete, I can see that they are included in the search results, but when I replace the WordPress search with Instant Search, it only searches Posts.
The search bar from my WordPress page should present the results based on the website content and an external documentation page. I have tried to combine all Typesense collections. However, I don't know how I can replace the collections used by the plugin:
Is it possible to use customizable collections with the Search with Typesense plugin?
Currently have to manually delete and re-index. How can we enable autorefresh of the index on a post update or new post being added?
Hello,
<mark></mark>
tags. According to the API docs, this should be on by default. Is there a way to get highlighting working when coming from WordPress? In the Typesense admin, when performing a search the term is highlighted there as seen here:Alternatively, there is also the JSON format as shown here:
Is there a way to get that JSON returned from search instead of the normal document? With that I could display the highlighted snippet instead of an excerpt. I guess that is more a Typesense API question but I have not found a way to do it.
posts | pages
and then querying against that to provide a global search. How would I go about doing that with the plugin? Is there a function to combine the different indices?A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.