diff --git a/app/data/filter_config.json b/app/data/filter_config.json new file mode 100644 index 0000000..de8a006 --- /dev/null +++ b/app/data/filter_config.json @@ -0,0 +1,228 @@ +{ + "filterGroups": [ + { + "id": "type", + "label": "Type", + "icon": "📋", + "order": 1, + "options": [ + { + "id": "storm_door", + "label": "Storm Door", + "value": "Storm Door", + "aliases": ["storm-door", "stormdoor"], + "keywords": ["storm", "door"], + "requiredKeywords": "all", + "associations": { + "productField": "subType.door", + "matchMethod": "exact", + "normalizedValue": "stormdoor" + } + }, + { + "id": "storm_window", + "label": "Storm Window", + "value": "Storm Window", + "aliases": ["storm-window", "stormwindow"], + "keywords": ["storm", "window"], + "requiredKeywords": "all", + "associations": { + "productField": "subType.window", + "matchMethod": "exact", + "normalizedValue": "stormwindow" + } + }, + { + "id": "primary_window", + "label": "Primary Window", + "value": "Primary Window", + "aliases": ["primary-window", "primarywindow"], + "keywords": ["primary", "window"], + "requiredKeywords": "all", + "associations": { + "productField": "subType.window", + "matchMethod": "exact", + "normalizedValue": "primarywindow" + } + } + ], + "logicWithinGroup": "OR", + "autoCheckBehavior": { + "enabled": true, + "requireAllKeywords": true, + "requireSequential": true, + "minSpecificity": 2 + } + }, + { + "id": "color", + "label": "Color", + "icon": "🎨", + "order": 2, + "options": [ + { + "id": "white", + "label": "White", + "value": "White", + "aliases": ["wht"], + "keywords": ["white"], + "requiredKeywords": "all", + "associations": { + "productField": "colors", + "matchMethod": "array_includes", + "normalizedValue": "white" + } + }, + { + "id": "bronze", + "label": "Bronze", + "value": "Bronze", + "aliases": ["brz", "brown"], + "keywords": ["bronze"], + "requiredKeywords": "all", + "associations": { + "productField": "colors", + "matchMethod": "array_includes", + "normalizedValue": "bronze" + } + }, + { + "id": "black", + "label": "Black", + "value": "Black", + "aliases": ["blk"], + "keywords": ["black"], + "requiredKeywords": "all", + "associations": { + "productField": "colors", + "matchMethod": "array_includes", + "normalizedValue": "black" + } + }, + { + "id": "sandstone", + "label": "Sandstone", + "value": "Sandstone", + "aliases": ["sand", "sndst"], + "keywords": ["sandstone"], + "requiredKeywords": "all", + "associations": { + "productField": "colors", + "matchMethod": "array_includes", + "normalizedValue": "sandstone" + } + }, + { + "id": "tan", + "label": "Tan", + "value": "Tan", + "aliases": [], + "keywords": ["tan"], + "requiredKeywords": "all", + "associations": { + "productField": "colors", + "matchMethod": "array_includes", + "normalizedValue": "tan" + } + }, + { + "id": "mill", + "label": "Mill", + "value": "Mill", + "aliases": ["mill finish"], + "keywords": ["mill"], + "requiredKeywords": "all", + "associations": { + "productField": "colors", + "matchMethod": "array_includes", + "normalizedValue": "mill" + } + } + ], + "logicWithinGroup": "OR", + "autoCheckBehavior": { + "enabled": true, + "requireAllKeywords": true, + "requireSequential": false, + "minSpecificity": 1 + } + }, + { + "id": "material", + "label": "Material", + "icon": "🔧", + "order": 3, + "options": [ + { + "id": "aluminum", + "label": "Aluminum", + "value": "Aluminum", + "aliases": ["alum", "aluminium", "al"], + "keywords": ["aluminum"], + "requiredKeywords": "all", + "associations": { + "productField": "materials", + "matchMethod": "array_includes", + "normalizedValue": "aluminum" + } + }, + { + "id": "vinyl", + "label": "Vinyl", + "value": "Vinyl", + "aliases": ["vnyl"], + "keywords": ["vinyl"], + "requiredKeywords": "all", + "associations": { + "productField": "materials", + "matchMethod": "array_includes", + "normalizedValue": "vinyl" + } + } + ], + "logicWithinGroup": "OR", + "autoCheckBehavior": { + "enabled": true, + "requireAllKeywords": true, + "requireSequential": false, + "minSpecificity": 1 + } + } + ], + "baseTypes": [ + { + "id": "door", + "label": "Door", + "keywords": ["door"], + "impliesOptions": ["storm_door"], + "productField": "baseType", + "normalizedValue": "door" + }, + { + "id": "window", + "label": "Window", + "keywords": ["window"], + "impliesOptions": ["storm_window", "primary_window"], + "productField": "baseType", + "normalizedValue": "window" + }, + { + "id": "patio_door", + "label": "Patio Door", + "keywords": ["patio", "door"], + "requiredKeywords": "all", + "impliesOptions": [], + "productField": "baseType", + "normalizedValue": "patiodoor" + } + ], + "searchBehavior": { + "defaultLogic": "AND", + "filterLogicBetweenGroups": "AND", + "filterLogicWithinGroup": "OR", + "processOrder": ["type", "color", "material"], + "removeMatchedFromSearch": true, + "requireSequentialForMultiWord": true, + "ignoreWords": ["and", "or", "the", "a", "an"] + } +} diff --git a/app/templates/advanced_search.html b/app/templates/advanced_search.html index 7c5edc4..fd5eec2 100644 --- a/app/templates/advanced_search.html +++ b/app/templates/advanced_search.html @@ -66,6 +66,101 @@ margin-bottom: 20px; color: #666; } + + /* Filter Sections */ + .filters-container { + max-width: 800px; + margin: 20px auto; + } + + .filter-section { + margin-bottom: 10px; + } + + .filter-toggle { + width: 100%; + background-color: #f8f9fa; + border: 1px solid #dee2e6; + border-radius: 6px; + padding: 12px 16px; + font-size: 14px; + color: #495057; + cursor: pointer; + display: flex; + align-items: center; + gap: 10px; + transition: all 0.2s ease; + text-align: left; + } + + .filter-toggle:hover { + background-color: #e9ecef; + border-color: #ced4da; + } + + .filter-icon { + font-size: 18px; + } + + .filter-label { + flex: 1; + display: flex; + flex-wrap: wrap; + gap: 5px; + } + + .filter-title { + font-weight: 600; + } + + .filter-values { + color: #6a4c93; + font-weight: 500; + } + + .filter-arrow { + font-size: 12px; + transition: transform 0.2s ease; + } + + .filter-content { + margin-top: 5px; + padding: 16px; + background-color: #fff; + border: 1px solid #dee2e6; + border-radius: 6px; + font-size: 14px; + } + + .filter-options { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); + gap: 10px; + } + + .filter-checkbox { + display: flex; + align-items: center; + gap: 8px; + cursor: pointer; + padding: 6px; + border-radius: 4px; + transition: background-color 0.2s ease; + } + + .filter-checkbox:hover { + background-color: #f8f9fa; + } + + .filter-checkbox input[type="checkbox"] { + width: 18px; + height: 18px; + cursor: pointer; + } + + .filter-checkbox span { + user-select: none; + } @@ -103,6 +198,14 @@ style="width: 100%; padding: 15px 20px; font-size: 16px; border: 2px solid #ddd; border-radius: 8px; box-sizing: border-box;" onkeyup="handleSearch(event)" > + + + + +
+ +
+