Spaces:
Paused
Paused
Update commons/queryBuilder.js
Browse files6 unmodified lines789101112136 unmodified lines202122232425262728293031323334353637383940416 unmodified linesmodule.exports = (args) => {const query = {};// Log the incoming args to see if we're getting the correct structureconsole.log("Incoming arguments for queryBuilder:", args);if (args.extra) {6 unmodified lines});}// Log the constructed queryconsole.log("Query constructed:", query);// Generate the Lucene query using a field-focused structureconst formattedQuery = convert({title: query.genre || '', // Ensure we handle the case if genre is not presentsubject: query.genre || '',description: query.genre || '',collection: query.genre || '',});console.log("Formatted Lucene Query:", formattedQuery); // Debugging: log the formatted queryif (formattedQuery) {return `(${formattedQuery}) AND !collection:(podcasts OR radio OR uspto)`;}return '';};6 unmodified lines7891011126 unmodified lines1920212223242526272829303132336 unmodified linesmodule.exports = (args) => {const query = {};console.log("Incoming arguments for queryBuilder:", args);if (args.extra) {6 unmodified lines});}console.log("Query constructed:", query);// Generate the Lucene query using a field-focused structureconst genre = query.genre || ''; // Get the genre or empty string if not present// Construct a more complex query based on your exampleconst 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))`;console.log("Formatted Lucene Query:", formattedQuery);return formattedQuery; // Return the constructed query directly};
commons/queryBuilder.js+5-13