twentyhq / twenty

Building a modern alternative to Salesforce, powered by the community.
https://twenty.com
GNU Affero General Public License v3.0
15.54k stars 1.63k forks source link

Ability to search Index views (List, Kanban) #6272

Open Bonapara opened 1 month ago

Bonapara commented 1 month ago

Current Behavior

Currently, to search within a view, you must create a filter on a specific field.

Desired Behavior

We want to enable users to search for a value across multiple fields simultaneously within a view. For example, if I type "ac" in the Companies object, it should find both the record named Slack and the Companies record owned by Jace.

We would like to introduce a new "Search" field that would contain a "vector". Since it's a field, it should be available in the filter menu. However, we don't want it to be available for display in the views, as it will not be readable.

It should be possible to add other filters alongside this one, as it should function like any other filter.

Design

https://github.com/user-attachments/assets/502f54d2-ce0f-4753-9d1d-4c6b87edd471

https://www.figma.com/design/xt8O9mFeLl46C5InWwoMrN/Twenty?node-id=35106-93609&t=7AIUhbIlhybiZdPQ-11

greptile-apps[bot] commented 1 month ago

Implementation Steps

  1. Create Search Field

    • Define a new field type for the search vector in the backend.
    • Ensure this field is indexed for efficient search.
  2. Update Metadata

    • Modify the object metadata to include the new search field.
    • Ensure this field is not included in the displayable fields.
  3. Filter Menu Integration

    • Update the filter menu component to include the new search field.
    • Path: /packages/twenty-front/src/modules/object-record/record-index/options/components/RecordIndexOptionsDropdownContent.tsx
  4. Search Logic

    • Implement the search logic to query across multiple fields using the search vector.
    • Path: /packages/twenty-front/src/modules/views/hooks/internal/useViewFilters.ts
  5. UI Updates

    • Ensure the search field is available in the filter menu but not in the view display options.
    • Path: /packages/twenty-front/src/modules/views/view-picker/components/ViewPickerCreateOrEditContent.tsx
  6. Testing

    • Verify that the search functionality works across multiple fields and integrates seamlessly with other filters.

References

/packages/twenty-front/src/modules/object-record/record-index/components/RecordIndexContainer.tsx /packages/twenty-front/src/modules/views/hooks/useSaveCurrentViewFields.ts /packages/twenty-front/src/modules/views/hooks/useGetCurrentView.ts /packages/twenty-front/src/modules/views/view-picker/components/ViewPickerCreateOrEditContent.tsx /packages/twenty-front/src/modules/views/hooks /packages/twenty-front/src/modules/views/types/View.ts /packages/twenty-front/src/modules/views/view-picker/components/ViewPickerCreateOrEditContentEffect.tsx /packages/twenty-front/src/modules/object-record/record-index/options/components/RecordIndexOptionsDropdownContent.tsx /packages/twenty-front/src/modules/views/hooks/internal/useViewFilters.ts /packages/twenty-front/src/pages/settings/data-model/SettingsObjectNewField/SettingsObjectNewFieldStep2.tsx

#### About Greptile This response provides a starting point for your research, not a precise solution. Help us improve! Please leave a ๐Ÿ‘ if this is helpful and ๐Ÿ‘Ž if it is irrelevant. [Ask Greptile](https://app.greptile.com/chat/github/twentyhq/twenty/main) ยท [Edit Issue Bot Settings](https://app.greptile.com/apps/github)