Comments (4)
I was able to replicate the issue with that. Thank you!
Turns out this is because Typesense server was returning invalid JSON:
{
"message": "Could not find `y` in the infix index. Make sure to enable infix search by specifying `"infix ": true` in the schema."
}
Notice how the double quotes are not escaped properly. We'll fix this in Typesense Server shortly.
from typesense.
Hmmm, could you give me a JS snippet that reproduces the issue?
Here's a template to use: https://github.com/typesense/typesense-js/blob/master/doc/examples/server/search.js
from typesense.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Typesense Browser Demo</title>
</head>
<body>
<div>
<h1>Typesense Browser Demo</h1>
<div>
<input id="search-input" type="text" placeholder="search terms"/>
<button id="search-button" type="submit" onclick=search()>Search</button>
</div>
<pre id="search-results">
</pre>
</div>
<script src="../../../dist/Typesense.js"></script>
<script>
/*
Setup: See clientInitalization.js for quick instructions on starting the Typesense server.
*/
// Create a client
// We're using Typesense.Client instead of Typesense.SearchClient just for the purposes of this example, so we can index using the same client
// You'd typically want to use Typesense.SearchClient in the browser, if you only need to perform search operations
var typesense = new Typesense.Client({
'nodes': [
{
'host': 'localhost',
'port': '8108',
'protocol': 'http'
}
],
'apiKey': 'xyz',
'numRetries': 3,
'connectionTimeoutSeconds': 10,
'retryIntervalSeconds': 0.1,
'healthcheckIntervalSeconds': 2,
'logLevel': 'debug'
})
let schema = {
'name': 'x',
'num_documents': 0,
'fields': [
{
'name': 'y',
'type': 'string'
}
]
}
// create a collection, in case it doesn't exist
// We're creating a collection from the browser just for the purposes of this example.
// You'd typically create a collection server-side and only use the search endpoint from the browser.
// So you want to pass an API key that only allows searches in the api-key field, instead of the master key when using this library in a browser.
// See keys.js in docs/examples/server/keys.js for an example of how to generate a search only API key.
function search () {
var searchTerm = document.getElementById('search-input').value
typesense.collections('x').documents().search({
'q': searchTerm,
'query_by': 'y',
'per_page': 10,
'infix': 'always'
}).then(function (searchResults) {
document.getElementById('search-results').innerHTML = JSON.stringify(searchResults, null, 2)
}).catch(function (error) {
document.getElementById('search-results').innerHTML = error
})
}
</script>
</body>
</html>
This should repeat it. At least I managed to reproduce it locally. (However, I tested it on our environment, so I really don't know if that will be repeated in a completely empty collection.)
![image](https://private-user-images.githubusercontent.com/21308995/333499978-38cca1d3-c8f5-4917-8119-fa08a811dafc.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjEwNjU2MzcsIm5iZiI6MTcyMTA2NTMzNywicGF0aCI6Ii8yMTMwODk5NS8zMzM0OTk5NzgtMzhjY2ExZDMtYzhmNS00OTE3LTgxMTktZmEwOGE4MTFkYWZjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzE1VDE3NDIxN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTBmMjQ1ZWUzZTViOTgyYzgyMWMwNzU0MjViMzg3MzllZjEyNDYyOGU3ZDNiZDRkMzA3NDEyZWJhNTQzYjdmZWMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.NP15WgJbEemEhtyc4EQIOgmY-TRF_rfrkPsVltHdkbU)
from typesense.
Fix is now available in 27.0.rc18
from typesense.
Related Issues (20)
- Nested fields schema float is created as int64[] HOT 2
- How to use the rankfusion score to filter irrelevant search results in hybrid search HOT 8
- max_candidates support for prefix filtering
- Where is the documentation for the q parameter? HOT 3
- Query string is only tokenized if the query_by field with the highest weight is a stemmed one HOT 4
- `conversation_model_id` is invalid. HOT 2
- Collections getting dropped / lost HOT 1
- Order of fields in schema matters when doing embed with type:auto field
- Cannot use Wildcard Collection Name in Keys HOT 1
- _eval function in sort_by fails with parentheses in string values
- Feature Request: Extend "Override Rules" with Additional Regex Support
- Support Azure OpenAI API signature HOT 1
- Does not turn off typo tolerance
- Creating an auto-embedding fields with an openai compatible api doesn't support dimension settings when an url is given HOT 1
- Is TODO.md current? HOT 2
- Duplicate Fields highlight and highlights in Query Response HOT 1
- When searching in field with many values, highlights do not include expected value HOT 1
- prefix=false request parameter is ignored in highlights, and potentially in matching_score and _text_match ordering
- Match in 2 different fields should be ranked higher by _text_match, than match in 2 different entries in a single field
- text_match score value is not affected by query_by_weights values HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typesense.