Spaces:
Paused
Paused
Update commons/queryBuilder.js
Browse files- commons/queryBuilder.js +3 -4
commons/queryBuilder.js
CHANGED
|
@@ -2,7 +2,6 @@ const { convert } = require('lucene-query-generator');
|
|
| 2 |
|
| 3 |
/**
|
| 4 |
* Builds a complex Lucene query formatted for Archive.org based on arguments.
|
| 5 |
-
* Ensures all query terms are properly formatted as strings.
|
| 6 |
*/
|
| 7 |
module.exports = (args) => {
|
| 8 |
const query = {};
|
|
@@ -22,12 +21,12 @@ module.exports = (args) => {
|
|
| 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';
|
| 26 |
|
| 27 |
-
// Construct
|
| 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 |
|
| 32 |
-
return formattedQuery;
|
| 33 |
};
|
|
|
|
| 2 |
|
| 3 |
/**
|
| 4 |
* Builds a complex Lucene query formatted for Archive.org based on arguments.
|
|
|
|
| 5 |
*/
|
| 6 |
module.exports = (args) => {
|
| 7 |
const query = {};
|
|
|
|
| 21 |
console.log("Query constructed:", query);
|
| 22 |
|
| 23 |
// Check for genre or fallback to a default if not provided
|
| 24 |
+
const genre = query.genre || 'General';
|
| 25 |
|
| 26 |
+
// Construct query focused only on supported fields
|
| 27 |
const formattedQuery = `((title:${genre}^100 OR subject:${genre}^25 OR description:${genre}^15) AND mediatype:movies AND !collection:(podcasts OR radio OR uspto))`;
|
| 28 |
|
| 29 |
console.log("Formatted Lucene Query:", formattedQuery);
|
| 30 |
|
| 31 |
+
return formattedQuery;
|
| 32 |
};
|