Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IDEA] Support exclusion file filters #728

Closed
debanjum opened this issue Apr 28, 2024 · 11 comments · Fixed by #826
Closed

[IDEA] Support exclusion file filters #728

debanjum opened this issue Apr 28, 2024 · 11 comments · Fixed by #826
Labels
good first issue Good for newcomers upgrade New feature or request

Comments

@debanjum
Copy link
Member

debanjum commented Apr 28, 2024

Describe the feature you'd like

Ability to exclude files or folders from being used by Khoj for a specific chat message

Example message: "Where did jeremy grow up? -file:/home/susan/*.md" should result in exclude susan's markdown notes when looking up answers

Khoj currently only supports inclusion file filters like "Where did jeremy grow up? file:/home/jeremy/*.md"

@debanjum debanjum added good first issue Good for newcomers upgrade New feature or request labels Apr 28, 2024
@debanjum debanjum changed the title [IDEA] Support exclusion file filtess [IDEA] Support exclusion file filters Apr 28, 2024
@ashanviii
Copy link

Hey @debanjum I'd like to work on this issue. If it's still unassigned, could you please assign it to me?

@debanjum
Copy link
Member Author

Hi @ashanviii , that'd be great! Let us know if you need any help with implementing the feature?
Please refer to the docs for contributing and the implementation of exclusion filters for the word filter to get some direction.
And feel free to suggest edits to the documentation and ask for any help if you're stuck

@ashanviii ashanviii removed their assignment May 27, 2024
@olanna12
Copy link

Hi @debanjum ! Is this item still available to work on? I would like to have it assigned to me. Thanks!

@sabaimran
Copy link
Member

sabaimran commented Jun 4, 2024

@olanna12 , do go for it. Given @ashanviii has unassigned themselves, I'm assuming it's up for grabs.

@srikary12
Copy link
Contributor

The file needs to be excluded, right. file filter needs to be updated

@srikary12
Copy link
Contributor

srikary12 commented Jun 7, 2024

I'm working on this file-exclusion. Feel free to contribute or suggest changes

@sabaimran
Copy link
Member

sabaimran commented Jun 7, 2024

@olanna12 , are you working on this? If not, @srikary12 can take it up. Let's wait a day or two for olanna12 to respond before changing the assignment.

@srikary12
Copy link
Contributor

@sabaimran Can I take this up?

@sabaimran
Copy link
Member

Sure, transferring to @srikary12 since others haven't responded. Let me know if you have questions!

@shantanuSakpal
Copy link
Contributor

hey @sabaimran , i see the pull request has not been merged since a month. whats the status?

@srikary12
Copy link
Contributor

@shantanuSakpal, I'm fixing some issues on the PR. I was occupied last few days. Will try to fix the issues by this weekend.

debanjum added a commit that referenced this issue Aug 12, 2024
### Overview
Support exclude file filter in user search queries

### Details
- All of the exclude file filter terms need to be satisfied
- Any one of the include file filter terms should be satisfied

### Example
- **Search Query**: *what happened yesterday? -file:"tasks.org" -file:"work.md" file:"diary.org" file:"journal.org*
- **Behavior**: Query will try find relevant notes in any of `journal.org` or `diary.org` and not in `tasks.org` and not in `work.md`

### Details
* Add support for exclusion file filters
* Translate file filter to valid Django DB entry filter regex
* Exclude all files when multiple exclude file filter in query

Previously we were applying an "Or" filter, which would exclude any
file mentioned in a query with multiple exclude file filter.

This is not what we naturally mean when we ask excluding a file in a query

* Rename, rearrange, deduplicate and add file filter tests

Closes #728
---------

Co-authored-by: Debanjum Singh Solanky <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers upgrade New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants