-
-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
filter_by not preserved on search page #54
Comments
I just tested this with this repo and it seems to be working fine for me. Could you fork the repo and help reproduce the issue with your dataset? |
I tested with the repo you mention. Here is my diff: --- a/docusaurus.config.js
+++ b/docusaurus.config.js
@@ -69,34 +69,19 @@ const config = {
typesenseCollectionName: 'typesense_docs', // Replace with your own doc site's name. Should match the collection name in the scraper settings.
typesenseServerConfig: {
- nearestNode: {
- host: 'qtg5aekc2iosjh93p.a1.typesense.net',
- port: 443,
- protocol: 'https',
- },
nodes: [
{
- host: 'qtg5aekc2iosjh93p-1.a1.typesense.net',
- port: 443,
- protocol: 'https',
- },
- {
- host: 'qtg5aekc2iosjh93p-2.a1.typesense.net',
- port: 443,
- protocol: 'https',
- },
- {
- host: 'qtg5aekc2iosjh93p-3.a1.typesense.net',
- port: 443,
- protocol: 'https',
- },
+ host: '127.0.0.1',
+ port: 8108,
+ protocol: 'http',
+ }
],
- apiKey: '8hLCPSQTYcBuK29zY5q6Xhin7ONxHy99', //insert search key here
+ apiKey: 'xyz', //insert search key here
},
// Optional: Typesense search parameters: https://typesense.org/docs/0.21.0/api/documents.md#search-parameters
typesenseSearchParameters: {
- filter_by: 'version:=27.1'
+ filter_by: 'version:=v1'
},
// Optional with the following typesense index: export TYPESENSE_API_KEY=xyz
docker run --name typesense -d -p 8108:8108 -v /data typesense/typesense:27.1 --data-dir /data --api-key=$TYPESENSE_API_KEY --enable-cors
cat <<'EOF' > schema.json
{"default_sorting_field":"item_priority","enable_nested_fields":false,"fields":[{"facet":false,"index":true,"infix":false,"locale":"","name":"anchor","optional":true,"sort":false,"stem":false,"store":true,"type":"string"},{"facet":false,"index":true,"infix":false,"locale":"en","name":"content","optional":true,"sort":false,"stem":false,"store":true,"type":"string"},{"facet":true,"index":true,"infix":false,"locale":"","name":"url","optional":false,"sort":false,"stem":false,"store":true,"type":"string"},{"facet":true,"index":true,"infix":false,"locale":"","name":"url_without_anchor","optional":true,"sort":false,"stem":false,"store":true,"type":"string"},{"facet":true,"index":true,"infix":false,"locale":"","name":"version","optional":true,"sort":false,"stem":false,"store":true,"type":"string[]"},{"facet":true,"index":true,"infix":false,"locale":"en","name":"hierarchy.lvl0","optional":true,"sort":false,"stem":false,"store":true,"type":"string"},{"facet":true,"index":true,"infix":false,"locale":"en","name":"hierarchy.lvl1","optional":true,"sort":false,"stem":false,"store":true,"type":"string"},{"facet":true,"index":true,"infix":false,"locale":"en","name":"hierarchy.lvl2","optional":true,"sort":false,"stem":false,"store":true,"type":"string"},{"facet":true,"index":true,"infix":false,"locale":"en","name":"hierarchy.lvl3","optional":true,"sort":false,"stem":false,"store":true,"type":"string"},{"facet":true,"index":true,"infix":false,"locale":"en","name":"hierarchy.lvl4","optional":true,"sort":false,"stem":false,"store":true,"type":"string"},{"facet":true,"index":true,"infix":false,"locale":"en","name":"hierarchy.lvl5","optional":true,"sort":false,"stem":false,"store":true,"type":"string"},{"facet":true,"index":true,"infix":false,"locale":"en","name":"hierarchy.lvl6","optional":true,"sort":false,"stem":false,"store":true,"type":"string"},{"facet":true,"index":true,"infix":false,"locale":"en","name":"type","optional":true,"sort":false,"stem":false,"store":true,"type":"string"},{"facet":true,"index":true,"infix":false,"locale":"en","name":".*_tag","optional":true,"sort":false,"stem":false,"store":true,"type":"string"},{"facet":true,"index":true,"infix":false,"locale":"","name":"language","optional":true,"sort":false,"stem":false,"store":true,"type":"string"},{"facet":true,"index":true,"infix":false,"locale":"en","name":"tags","optional":true,"sort":false,"stem":false,"store":true,"type":"string[]"},{"facet":false,"index":true,"infix":false,"locale":"","name":"item_priority","optional":false,"sort":true,"stem":false,"store":true,"type":"int64"},{"facet":true,"index":true,"infix":false,"locale":"en","name":"docusaurus_tag","optional":true,"sort":false,"stem":false,"store":true,"type":"string"}],"name":"typesense_docs","symbols_to_index":[],"token_separators":["_","-"]}
EOF
cat <<'EOF' > data.jsonl
{"content":"This is a v1 test","content_camel":"This is a v1 test","docusaurus_tag":"docs-default-current","hierarchy":{"lvl0":"v1","lvl1":"Test","lvl2":null,"lvl3":null,"lvl4":null,"lvl5":null,"lvl6":null},"hierarchy.lvl0":"v1","hierarchy.lvl1":"Test","hierarchy.lvl2":null,"hierarchy.lvl3":null,"hierarchy_camel":[{"lvl0":"v1","lvl1":"Test","lvl2":null,"lvl3":null,"lvl4":null,"lvl5":null,"lvl6":null}],"hierarchy_radio":{"lvl0":null,"lvl1":null,"lvl2":null,"lvl3":null},"hierarchy_radio_camel":{"lvl0":null,"lvl1":null,"lvl2":null,"lvl3":null},"id":"1","item_priority":1,"language":"en","no_variables":false,"objectID":"1","tags":[],"type":"content","url":"https://test.com/v1/test","url_without_anchor":"https://test.com/v1/test","url_without_variables":"https://test.com/v1/test","version":["v1"],"weight":{"level":0,"page_rank":0,"position":1,"position_descending":1}}
{"content":"This is a v2 test","content_camel":"This is a v2 test","docusaurus_tag":"docs-default-current","hierarchy":{"lvl0":"v2","lvl1":"Test","lvl2":null,"lvl3":null,"lvl4":null,"lvl5":null,"lvl6":null},"hierarchy.lvl0":"v2","hierarchy.lvl1":"Test","hierarchy.lvl2":null,"hierarchy.lvl3":null,"hierarchy_camel":[{"lvl0":"v2","lvl1":"Test","lvl2":null,"lvl3":null,"lvl4":null,"lvl5":null,"lvl6":null}],"hierarchy_radio":{"lvl0":null,"lvl1":null,"lvl2":null,"lvl3":null},"hierarchy_radio_camel":{"lvl0":null,"lvl1":null,"lvl2":null,"lvl3":null},"id":"2","item_priority":1,"language":"en","no_variables":false,"objectID":"2","tags":[],"type":"content","url":"https://test.com/v2/test","url_without_anchor":"https://test.com/v2/test","url_without_variables":"https://test.com/v2/test","version":["v2"],"weight":{"level":0,"page_rank":0,"position":1,"position_descending":1}}
EOF
curl -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -X POST "http://127.0.0.1:8108/collections" -H "Content-Type: application/json" -d @schema.json
curl -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -X POST "http://127.0.0.1:8108/collections/typesense_docs/documents/import?action=create" --data-binary @data.jsonl Then:
|
Ah I see, so the modal works fine, it's just the "All Search Results" page that's the issue. So on the that page, I do pass in the additional Typesense search parameters when instantiating the adapter here:
But what seems to be happening is that Docusaurus* seems to be overriding it here with its own filters: docusaurus-theme-search-typesense/src/theme/SearchPage/index.tsx Lines 352 to 362 in f9ad577
*I say Docusaurus here because, I originally forked this from the Docusaurus' Algolia plugin. So based on this, I wonder if there's a different way to search through versioned docs when using Docusaurus... I'd recommend researching the Docusaurus Algolia integration to see how they handle versioned docs and the same should apply here as well. |
Yes that's it 👍 My point is having a "See all 1 results" going to a page where 2 results are displayed looks like a bug 😅 |
Description
I'm running:
My index contains documents with some version tagged v1 and others v2.
I don't want to see my v1 docs when I search (I use it for something else).
I'm using the following config:
I've a perfectly working sidebar search.
But I see all results v1 + v2 results. I'll like to see only v2 results.
Steps to reproduce
Expected Behavior
See consistent results between the search bar and the search page.
Actual Behavior
I see all results, my
filter_by
parameters not preserved on multi_search query on search page.Metadata
Typesense Version: v27.1
OS: linux/amd64
The text was updated successfully, but these errors were encountered: