# Search Integration Plan

## 1. File Structure
```plaintext
core/
├── views/
│   └── search.py          # Search views implementation
├── utils/
│   └── search.py          # Search utilities
templates/
└── core/
    └── search/            # Search templates
        ├── results.html
        ├── filters.html
        └── ... 
```

## 2. View Migration
- Move `search/views.py` → `core/views/search.py`
- Update view references:
```python
# Old: from search.views import AdaptiveSearchView
# New:
from core.views.search import AdaptiveSearchView, FilterFormView
```

## 3. URL Configuration Updates
Update `thrillwiki/urls.py`:
```python
# Before:
path("search/", include("search.urls", namespace="search"))

# After:
path("search/", include("core.urls.search", namespace="search"))
```

Create `core/urls/search.py`:
```python
from django.urls import path
from core.views.search import AdaptiveSearchView, FilterFormView
from rides.views import RideSearchView

urlpatterns = [
    path('parks/', AdaptiveSearchView.as_view(), name='search'),
    path('parks/filters/', FilterFormView.as_view(), name='filter_form'),
    path('rides/', RideSearchView.as_view(), name='ride_search'),
    path('rides/results/', RideSearchView.as_view(), name='ride_search_results'),
]
```

## 4. Import Cleanup Strategy
1. Update all imports:
```python
# Before:
from search.views import ...
from search.utils import ...

# After:
from core.views.search import ...
from core.utils.search import ...
```

2. Remove old search app:
```bash
rm -rf search/
```

3. Update `INSTALLED_APPS` in `thrillwiki/settings.py`:
```python
# Remove 'search' from INSTALLED_APPS
INSTALLED_APPS = [
    # ...
    # 'search',  # REMOVE THIS LINE
    # ...
]
```

## 5. Implementation Steps
1. Create new directory structure in core
2. Move view logic to `core/views/search.py`
3. Create URL config in `core/urls/search.py`
4. Move templates to `templates/core/search/`
5. Update all import references
6. Remove old search app
7. Test all search functionality:
   - Park search filters
   - Ride search
   - HTMX filter updates
8. Verify URL routes

## 6. Verification Checklist
- [ ] All search endpoints respond with 200
- [ ] Filter forms render correctly
- [ ] HTMX updates work as expected
- [ ] No references to old search app in codebase
- [ ] Templates render with correct context