Troubleshooting Typesense Setup and Understanding Facets and Keywords
TLDR Demitri encountered errors when exploring Typesense for the first time. Jason guided them through troubleshooting and discussed facets, keyword settings, and widget configurations. Helin shared a Python demo app and its source code to help Demitri with their project.

Mar 04, 2022 (18 months ago)
Demitri
01:25 AM[Error] Error: 404 - Could not find a facet field named `*` in the schema. — TypesenseInstantsearchAdapter.js:81
_callee$ (app.a6a4d504.js:7599)
tryCatch (app.a6a4d504.js:192)
invoke (app.a6a4d504.js:423)
asyncGeneratorStep (app.a6a4d504.js:890)
_next (app.a6a4d504.js:912)
promiseReactionJob
[Error] Unhandled Promise Rejection: Error: 404 - Could not find a facet field named `*` in the schema.
(anonymous function) ([email protected]:2:32449)
(anonymous function) ([email protected]:2:105993)
(anonymous function) ([email protected]:2:32639)
(anonymous function) (instantsearch.js@4.39.1:2:49241)
(anonymous function)
promiseReactionJob
Is this something I am missing in
app.js
?Jason
01:39 AMdynamicWidgets
in app.js? If so, could you remove it and try again?Demitri
02:01 AMCould not find a facet named 'abstract' in the schema
. One of my fields in my schema is called “abstract”.Jason
02:02 AMJason
02:02 AMDemitri
02:04 AM{
"name": "ascl_entries",
"fields": [
{
"name": "ascl_id",
"type": "string",
"facet": false,
"optional": false,
"index": true
},
{
"name": "title",
"type": "string",
"facet": false,
"optional": false,
"index": true
},
{
"name": "credit",
"type": "string",
"facet": false,
"optional": false,
"index": true
},
{
"name": "abstract",
"type": "string",
"facet": false,
"optional": false,
"index": true
},
{
"name": "topic_id",
"type": "string",
"facet": false,
"optional": false,
"index": true
},
{
"name": "bibcode",
"type": "string",
"facet": false,
"optional": false,
"index": true
},
{
"name": "views",
"type": "string",
"facet": false,
"optional": false,
"index": true
},
{
"name": "preferred_citation",
"type": "string",
"facet": false,
"optional": false,
"index": true
},
{
"name": "site_list",
"type": "string[]",
"facet": false,
"optional": false,
"index": true
},
{
"name": "used_in",
"type": "string[]",
"facet": false,
"optional": false,
"index": true
},
{
"name": "described_in",
"type": "string[]",
"facet": false,
"optional": false,
"index": true
}
],
"default_sorting_field": ""
}
Jason
02:04 AM"facet": true
for the abstract field if you want to use it with instant searchDemitri
02:04 AMschema = {
"name" : "ascl_entries",
"fields" : [
{ "name":"ascl_id", "type":"string" },
{ "name":"title", "type":"string"},
{ "name":"credit", "type":"string"},
{ "name":"abstract", "type":"string"},
{ "name":"topic_id", "type":"string"},
{ "name":"bibcode", "type":"string"},
{ "name":"views", "type":"string"},
{ "name":"preferred_citation", "type":"string"},
{ "name":"site_list", "type":"string[]"},
{ "name":"used_in", "type":"string[]"},
{ "name":"described_in", "type":"string[]"}
#{ "name":"keywords", "type":"string[]"},
]#,
# "default_sorting_field": "title" # optional
}
Demitri
02:05 AMJason
02:05 AMJason
02:06 AMDemitri
02:09 AM"facet":True
to the schema worked. I don’t have the text of the full papers, just the abstracts. I’m not sure what you mean though; the intent was to be able to filter on arbitrary words, e.g. “hydrogen”.Jason
02:10 AMDemitri
02:10 AMJason
02:11 AMJason
02:12 AMJason
02:13 AMDemitri
02:14 AMkeywords
field in my schema, the data set I am using as a sample doesn’t have any of those populated. I’m not familiar with the refinementList? This is literally my first time using Typesense; just trying to get a minimum working example to see how I might integrate it into a web app. This is the whole of the app.js
, pretty short. I minimally modified it from the template.const { algoliasearch, instantsearch } = window;
import TypesenseInstantSearchAdapter from "typesense-instantsearch-adapter";
const typesenseInstantsearchAdapter = new TypesenseInstantSearchAdapter({
server: {
apiKey: "zPOYYT6TdNOIK9h87bzv5GPtZXIMaxJC", // Be sure to use the search-only-api-key
nodes: [
{
host: "localhost",
port: "8108",
protocol: "http"
}
]
},
// The following parameters are directly passed to Typesense's search API endpoint.
// So you can pass any parameters supported by the search endpoint below.
// queryBy is required.
additionalSearchParameters: {
query_by: "title,abstract"
}
});
const searchClient = typesenseInstantsearchAdapter.searchClient;
const search = instantsearch({
searchClient,
indexName: "ascl_entries"
});
search.addWidgets([
instantsearch.widgets.searchBox({
container: '#searchbox',
}),
instantsearch.widgets.hits({
container: '#hits',
templates: {
item: `
<div>
<img src="" align="left" alt="" />
<div class="hit-name">
{{#helpers.highlight}}{ "attribute": "title" }{{/helpers.highlight}}
</div>
<div class="hit-abstract">
{{#helpers.highlight}}{ "attribute": "abstract" }{{/helpers.highlight}}
</div>
<div class="hit-ascl_id">ASCL ID: </div>
</div>
`,
},
}),
instantsearch.widgets.configure({
facets: ['abstract'],
maxValuesPerFacet: 20,
}),
// instantsearch.widgets.dynamicWidgets({
// container: '#dynamic-widgets',
// fallbackWidget({ container, attribute }) {
// return instantsearch.widgets.refinementList({
// container,
// attribute,
// });
// },
// widgets: [],
// }),
instantsearch.widgets.pagination({
container: '#pagination',
}),
]);
search.start();
Jason
02:15 AMYou can also comment out this part:
instantsearch.widgets.configure({
facets: ['abstract'],
maxValuesPerFacet: 20,
}),
Jason
02:15 AMJason
02:16 AMJason
02:17 AMfacet: true
on a field with almost all unique values across records ends up using a lot of memory...Demitri
02:18 AMJason
02:18 AMDemitri
02:19 AMJason
02:23 AMHere's one example: if you have a list of products, you'd typically set
color
, brand
as faceted field, so you can display a filter to users that lets them drill-down products based on color or brand.Demitri
02:28 AMDemitri
02:30 AMJason
02:30 AMDid you mean unique list of records, or keywords?
Jason
02:32 AMDemitri
02:36 AMJason
02:36 AMJason
02:37 AMDemitri
02:37 AMJason
02:38 AMDemitri
02:38 AMJason
02:39 AMDemitri
02:40 AMDemitri
02:40 AMJason
02:40 AMJason
02:43 AMThis is also possible. The brand filter uses this refinementList widget which does an OR by default. You can change it to AND like this: https://www.algolia.com/doc/api-reference/widgets/refinement-list/js/#widget-param-operator
Demitri
02:45 AMDemitri
02:49 AMJason
02:49 AMYou can also load the instantsearch adapter to get those widgets to work with Typesense via a script tag like this: https://github.com/typesense/typesense-instantsearch-adapter#installation
And after that, you can just use regular JS inside script tags in your html views to load the widgets
Demitri
02:51 AMJason
02:52 AMDemitri
02:53 AMJason
02:54 AMJason
04:41 AMHelin
04:47 AMMar 15, 2022 (18 months ago)
Demitri
03:28 PMMar 30, 2022 (18 months ago)
Helin
07:35 PMDemitri
08:09 PMHelin
10:23 PMYou can either try it on localhost (after
pip install pywebio
), or run it on build.pyweb.io.Note that the live demo does not work anymore as my Typesense cloud usage has exceeded the free tier limit. I should probably ask for a complete free account for this demo purpose (cc Jason 🙂 )
Jason
10:50 PM
Mar 31, 2022 (18 months ago)
Helin
12:06 AMTypesense
Indexed 2764 threads (79% resolved)
Similar Threads
Typesense Capabilities and Troubleshooting Queries
A had issues with refinement lists and analytics in Typesense. Jason provided a possible solution and recommended the analytics widget. They clarified import size limits and helped identify a filter issue in A's query. Upgrade options are in Typesense's roadmap.


Fixing Multiple Document Retrieval in Typesense
Phil needed an efficient way to retrieve multiple documents by id. Kishore Nallan proposed a solution available in a pre-release build. After some bug fixing regarding id matching by Jason and Kishore Nallan, Phil successfully tested the solution.



Querying and Indexing Multiple Elements Issues
Krish queried fields with multiple elements, which Kishore Nallan suggested checking `drop_tokens_threshold`. Krish wished to force OR mode for token, but Kishore Nallan admitted the feature was missing. Krish was able to resolve the issue with url encoding.
Understanding and Implementing Typesense Dart Library with Flutter
Alexandro sought help with the Typesense Dart library. Jason explained that the library is in progress, discussed utilizing other HTTP libraries, and provided detailed instructions on utilizing Typesense with Flutter. Alexandro provided feedback on the Typesense UI and expressed interest in creating a tutorial video.



Querying with Typesense-Js and Handling Null Values
michtio was querying using typesense-js and receiving fewer results than expected. Kishore Nallan suggested using different query parameters. Further discussion led to the handling of 'null' values and filtering syntax in the search queries. The thread ended with Jason offering migration support from Algolia to Typesense.


