-
Notifications
You must be signed in to change notification settings - Fork 94
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
Exclude specific directory pattern from search results #179
Comments
Currently you cannot. However it raises an interesting question. Some may want to remove certain portion of the file from the general search logic. Currently in the indexing pipeline it is hard-coded to add certain things such as path and the like. Being able to control this would allow you to configure the above. |
So this is now sitting in issue179 branch. You can now control what makes its way into the "all" database. By default this would be the following
However in your case you would want to remove path from the above. Then the path information will not be added to the general index. You will still be able to click on a path inside the UI to narrow to just that directory, but say you have |
Resolved all unit tests. Have verified that this works by setting it to only index the path by setting @opt9 For your case pull from master, build and set your searchcode.properties file to have the following |
Thanks for your efforts. :-) There seems to be a miscommunication. I'm using so many open source libraries, including AngularJS. I'm not interested in AngularJS documents. So I want to exclude "my_repo/resources/angularjs/doc/*" directory from results. For example, if I want to search "{{{" in our code, I get so many AngularJS example codes in AngularJS documents. but it's not I want and annoying. In other words, I want to narrow down search scope to my codes, excluding 3rd party libraries. If you have any question, please do not hesitate to reply. Thanks ;-) |
If you don’t mind, Would you please reopen #179 ? |
I think you can already do that actually based on what you have described. So when you do a search have a look at the results, you can see where it says for each file For example, http://demo.searchcodeserver.com/?q=copyright&repo=go&fl=doc_codewalk is filtered down to the /doc/codewalk directory inside Go. In your case you would need to use something like,
Which should produce what you want. Admittedly there could be a better way to allow this filtering to happen on the UI somehow rather than just allowing you to filter down though the click. Something I will have a think about. Is your real intention to just limit the search of never index those files? |
@opt9 Does that work for you? I have a few ideas on how to make this better consumed through the filters but wondering if at least it unblocks you. |
IMO, it’s not related to indexes. and the inclusion of a specific directory is different from the exclusion of a specific directory pattern If I can search with “?q=foo&fl<>/doc/”, that would be perfect. Because I want to search all repositories have a “foo” keyword but exclude all documents directories. |
Oops, TIL, GitHub markdown change my one asterisk to italic, double asterisks to bold. |
Hmm ill have a think about if that's easily possible. It should be easy to do though the current search I think. Just requires some thinking about it. |
When I search with "some" keyword, so many results are returned and almost all of them are ".../doc/..." directories.
I've found "Path Filter" in UI, but It's disabled and can't use.
How can I exclude a specific directory pattern from search results?
The text was updated successfully, but these errors were encountered: