Spaces:
Paused
Paused
Update commons/queryBuilder.js
Browse files5 unmodified lines678991011128 unmodified lines2122232425242526272827282930315 unmodified lines */module.exports = (args) => { const query = {};
console.log("Incoming arguments for queryBuilder:", args);
if (args.extra) {8 unmodified lines
console.log("Query constructed:", query);
// Generate the Lucene query using a field-focused structure const genre = query.genre || ''; // Get the genre or empty string if not present // Check for genre or fallback to a default if not provided const genre = query.genre || 'General'; // Use 'General' or another common term as a fallback
// Construct a more complex query based on your example const formattedQuery = `((title:${genre}^100 OR salients:${genre}^50 OR subject:${genre}^25 OR description:${genre}^15 OR collection:${genre}^10 OR language:${genre}^10 OR text:${genre}^1) AND !collection:(podcasts OR radio OR uspto))`; // Construct a query formatted for Archive.org, specifying fields to avoid fl errors const formattedQuery = `((title:${genre}^100 OR subject:${genre}^25 OR description:${genre}^15) AND mediatype:movies AND !collection:(podcasts OR radio OR uspto))`;
console.log("Formatted Lucene Query:", formattedQuery);
commons/queryBuilder.js+5-5