Commit
·
5ca5908
1
Parent(s):
b8692a1
Enhance semantic search with expanded API query parameters
Browse files- index.html +8 -4
index.html
CHANGED
|
@@ -135,9 +135,13 @@
|
|
| 135 |
async filterType(filter) {
|
| 136 |
this.filter = filter;
|
| 137 |
this.page = 1;
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
},
|
| 142 |
async searchThemes() {
|
| 143 |
this.page = 1;
|
|
@@ -163,7 +167,7 @@
|
|
| 163 |
let searchUrl;
|
| 164 |
if (this.searchQuery) {
|
| 165 |
if (this.searchType === 'semantic') {
|
| 166 |
-
searchUrl = `https://huggingface.co/api/spaces/semantic-search?q=${encodeURIComponent(this.searchQuery)}`;
|
| 167 |
} else {
|
| 168 |
searchUrl = `https://huggingface.co/api/spaces?limit=100&filter=${searchFilters}&search=${encodeURIComponent(this.searchQuery)}&expand[]=subdomain&expand[]=lastModified&expand[]=likes&expand[]=runtime`;
|
| 169 |
}
|
|
|
|
| 135 |
async filterType(filter) {
|
| 136 |
this.filter = filter;
|
| 137 |
this.page = 1;
|
| 138 |
+
if (this.searchQuery) {
|
| 139 |
+
await this.searchThemes();
|
| 140 |
+
} else {
|
| 141 |
+
const data = await this.getThemes(this.page, this.sort, this.useTestData);
|
| 142 |
+
this.themes = data.themes;
|
| 143 |
+
this.totalPages = data.totalPages;
|
| 144 |
+
}
|
| 145 |
},
|
| 146 |
async searchThemes() {
|
| 147 |
this.page = 1;
|
|
|
|
| 167 |
let searchUrl;
|
| 168 |
if (this.searchQuery) {
|
| 169 |
if (this.searchType === 'semantic') {
|
| 170 |
+
searchUrl = `https://huggingface.co/api/spaces/semantic-search?limit=100&filter=${searchFilters}&q=${encodeURIComponent(this.searchQuery)}&expand[]=subdomain&expand[]=lastModified&expand[]=likes&expand[]=runtime`;
|
| 171 |
} else {
|
| 172 |
searchUrl = `https://huggingface.co/api/spaces?limit=100&filter=${searchFilters}&search=${encodeURIComponent(this.searchQuery)}&expand[]=subdomain&expand[]=lastModified&expand[]=likes&expand[]=runtime`;
|
| 173 |
}
|