-
Notifications
You must be signed in to change notification settings - Fork 147
Refactor org.eclipse.help.internal.search.SearchIndex#openSearcher() #1726
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
Refactor org.eclipse.help.internal.search.SearchIndex#openSearcher() #1726
Conversation
|
@iloveeclipse This is a work for Advantest. The only purpose of this change is to add a method to an internal class. We want to use this and #1725 to enhance the local help search with the help of semantic search. More precisely, a hybrid search consisting of a semantic search and a sparse keyword search based on the existing internal local search to enhance the top search results by adding hits and/or changing the ranking. The limitation of hybrid search is that help content needs to be shipped with a pre-built index of the embeddings, also called a vector store, because indexing takes significantly longer for semantic search than for keyword search, where a pre-built index is optional. Advantest intends to open source and contribute the hybrid search to Eclipse, for which some work still needs to be done. |
|
The build failed for no obvious reason in unrelated code. I've retriggered build now. |
It is because your PR is FAR behind master! I will rebase now. |
f11951a to
46620d3
Compare
|
Same as on other PR: could you provide a simple test that uses this new method (even if it is experimental)? |
|
The last build failed due heap space problem, not related to this PR change. I've re-triggered that again. |
I'm not sure if this is really required as the new experimental method |
The point is: there is an internal public method without uses. As a responsible maintainer I would tend to remove it, simply because any extra unused code is wasting our time/resources. If there is an example test that shows that the code does something useful, I would not touch that and even fix that if it should later fail. |
ua/org.eclipse.help.base/src/org/eclipse/help/internal/search/SearchIndex.java
Outdated
Show resolved
Hide resolved
jukzi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer not to add this unreferenced code but to make the needed methods more public. is "protected" enough?
46620d3 to
6372909
Compare
|
@howlger : please if you push your updated changes, before doing that rebase your branch on latest state. It just wastes time to run tests on ancient platform state that doesn't compile anymore. I will rebase now. |
In `org.eclipse.help.internal.search.SearchIndex`, refactor the `openSearcher()` method to return an `AutoCloseable` object so that it can be used in a try-with-resources statement that implicitly registers and unregisters the search. Minor performance improvement: Use double-checked locking idiom for lazy initialization of the `IndexSearcher`. Grant access to the `searches` and `analyzerDescriptor` fields via `SearcherInfo#getIndexSearcher()` and `SearcherInfo#getAnalyzerDescriptor()`. These two getter methods are not (yet) used internally. Their only purpose is to be able to implement a hybrid search that combines a semantic search with a sparse keyword search. And the sparse keyword search uses the existing `SearchIndex`, which requires access to these fields.
6372909 to
e26c56d
Compare
Your feedback gave me an idea and I have removed the |
@iloveeclipse Thanks, I missed that. Please note that I have now chosen a different approach which IMHO speeds up the existing search a bit and improves the readability of the code a bit. |
|
Build failed again due heap space issues (unrelated to the changes here)... I've restarted it. |
Indeed, the code is cleaner now. Thanks. |
|
Thanks everyone for your feedback and for applying. |
In
org.eclipse.help.internal.search.SearchIndex, refactor theopenSearcher()method to return anAutoCloseableobject so that it can be used in a try-with-resources statement that implicitly registers and unregisters the search.Minor performance improvement: Use double-checked locking idiom for lazy initialization of the
IndexSearcher.Grant access to the
searchesandanalyzerDescriptorfields viaSearcherInfo#getIndexSearcher()andSearcherInfo#getAnalyzerDescriptor(). These two getter methods are not (yet) used internally. Their only purpose is to be able to implement a hybrid search that combines a semantic search with a sparse keyword search. And the sparse keyword search uses the existingSearchIndex, which requires access to these fields.