Files
Strix/webui/web/js/api/camera-search.js
T
eduard256 74fe12bcf1 Improve camera model search with per-model ranking and two-stage loading
- Split camera results into individual models (Brand: Model format)
- Add model-specific relevance scoring for better search results
- Implement two-stage autocomplete: 10 results immediately, 50 after 1 second
- Filter out "Other" models from search results
- Sort models by relevance score (exact matches first)
- Add auto.json brand for automatic detection fallback

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 00:43:03 +03:00

28 lines
784 B
JavaScript

export class CameraSearchAPI {
constructor(baseURL = null) {
// Auto-detect API URL based on current host
if (!baseURL) {
const currentHost = window.location.hostname;
this.baseURL = `http://${currentHost}:8080`;
} else {
this.baseURL = baseURL;
}
}
async search(query, limit = 10) {
const response = await fetch(`${this.baseURL}/api/v1/cameras/search`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ query, limit }),
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return await response.json();
}
}