Spaces:
Paused
Paused
Update commons/queryBuilder.js
Browse files- commons/queryBuilder.js +5 -5
commons/queryBuilder.js
CHANGED
|
@@ -6,7 +6,7 @@ const { convert } = require('lucene-query-generator');
|
|
| 6 |
*/
|
| 7 |
module.exports = (args) => {
|
| 8 |
const query = {};
|
| 9 |
-
|
| 10 |
console.log("Incoming arguments for queryBuilder:", args);
|
| 11 |
|
| 12 |
if (args.extra) {
|
|
@@ -21,11 +21,11 @@ module.exports = (args) => {
|
|
| 21 |
|
| 22 |
console.log("Query constructed:", query);
|
| 23 |
|
| 24 |
-
//
|
| 25 |
-
const genre = query.genre || ''; //
|
| 26 |
|
| 27 |
-
// Construct a
|
| 28 |
-
const formattedQuery = `((title:${genre}^100 OR
|
| 29 |
|
| 30 |
console.log("Formatted Lucene Query:", formattedQuery);
|
| 31 |
|
|
|
|
| 6 |
*/
|
| 7 |
module.exports = (args) => {
|
| 8 |
const query = {};
|
| 9 |
+
|
| 10 |
console.log("Incoming arguments for queryBuilder:", args);
|
| 11 |
|
| 12 |
if (args.extra) {
|
|
|
|
| 21 |
|
| 22 |
console.log("Query constructed:", query);
|
| 23 |
|
| 24 |
+
// Check for genre or fallback to a default if not provided
|
| 25 |
+
const genre = query.genre || 'General'; // Use 'General' or another common term as a fallback
|
| 26 |
|
| 27 |
+
// Construct a query formatted for Archive.org, specifying fields to avoid fl errors
|
| 28 |
+
const formattedQuery = `((title:${genre}^100 OR subject:${genre}^25 OR description:${genre}^15) AND mediatype:movies AND !collection:(podcasts OR radio OR uspto))`;
|
| 29 |
|
| 30 |
console.log("Formatted Lucene Query:", formattedQuery);
|
| 31 |
|