Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app-next/src/app/[locale]/(learn)/contribute/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ export default async function ContributePage({
icon: Code,
},
{
label: "Docs",
href: "https://docs.openml.org/Website/",
label: "Developer docs",
href: "https://docs.openml.org/contributing/website/Website/",
icon: BookOpen,
},
].map((item) => (
Expand Down Expand Up @@ -332,7 +332,7 @@ export default async function ContributePage({
</div>
<div className="flex flex-wrap gap-2">
<Link
href="https://docs.openml.org/Website/"
href="https://docs.openml.org/contributing/website/Website/"
target="_blank"
>
<Button
Expand Down
36 changes: 27 additions & 9 deletions app-next/src/app/api/proxy-file/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,14 @@ export async function GET(request: NextRequest) {
}

try {
// Forward the client's Accept-Encoding to avoid serving gzip/brotli to
// clients that can't handle it (fixes #367)
const clientEncoding = request.headers.get("accept-encoding") || "identity";

const response = await fetch(url, {
headers: {
"User-Agent": "OpenML-NextApp/1.0",
"Accept-Encoding": clientEncoding,
},
});

Expand All @@ -64,26 +69,39 @@ export async function GET(request: NextRequest) {
upstreamContentType.includes("octet-stream") ||
upstreamContentType.includes("parquet");

// Pass through content-encoding so the client knows if it's compressed
const contentEncoding = response.headers.get("content-encoding");

if (isBinary) {
// Binary response (parquet files)
const buffer = await response.arrayBuffer();
const binaryHeaders: Record<string, string> = {
"Content-Type": "application/octet-stream",
"Content-Length": buffer.byteLength.toString(),
"Cache-Control": "public, max-age=86400",
"Vary": "Accept-Encoding",
};
if (contentEncoding) {
binaryHeaders["Content-Encoding"] = contentEncoding;
}
return new NextResponse(buffer, {
status: 200,
headers: {
"Content-Type": "application/octet-stream",
"Content-Length": buffer.byteLength.toString(),
"Cache-Control": "public, max-age=86400",
},
headers: binaryHeaders,
});
} else {
// Text response (ARFF, CSV, predictions)
const text = await response.text();
const textHeaders: Record<string, string> = {
"Content-Type": upstreamContentType,
"Cache-Control": "public, max-age=3600",
"Vary": "Accept-Encoding",
};
if (contentEncoding) {
textHeaders["Content-Encoding"] = contentEncoding;
}
return new NextResponse(text, {
status: 200,
headers: {
"Content-Type": upstreamContentType,
"Cache-Control": "public, max-age=3600",
},
headers: textHeaders,
});
}
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion app-next/src/components/layout/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ export function Footer() {
</li>
<li>
<a
href="docs.openml.org/pytorch/"
href="https://docs.openml.org/pytorch/"
className="text-slate-400 transition-colors hover:text-white"
target="_blank"
rel="noopener noreferrer"
Expand Down
18 changes: 17 additions & 1 deletion app-next/src/services/OpenMLSearchConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,22 @@ class OpenMLSearchConnector implements APIConnector {
});
}

// Issue #385: If the search term contains spaces, also search for the underscored version
// This allows "house prices nominal" to match the dataset "house_prices_nominal"
if (searchTerm.includes(" ")) {
const underscoredTerm = searchTerm.replace(/\s+/g, "_");
shouldClauses.push({
multi_match: {
query: underscoredTerm,
fields: searchFields.map(
(f) =>
`${f}^${(queryConfig.search_fields?.[f]?.weight || 1) * 2}`,
),
type: "phrase",
},
});
}

query.bool?.must?.push({
bool: {
should: shouldClauses,
Expand Down Expand Up @@ -383,7 +399,7 @@ class OpenMLSearchConnector implements APIConnector {
totalPages: Math.ceil(totalResults / (requestState.resultsPerPage || 10)),
pagingStart:
((requestState.current || 1) - 1) *
(requestState.resultsPerPage || 10) +
(requestState.resultsPerPage || 10) +
1,
pagingEnd: Math.min(
(requestState.current || 1) * (requestState.resultsPerPage || 10),
Expand Down
Loading