-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
CHE-5174 Improving search results #5874
Conversation
@@ -10,13 +10,15 @@ | |||
*******************************************************************************/ | |||
package org.eclipse.che.ide.api.project; | |||
|
|||
import org.eclipse.che.api.project.shared.dto.SearchResultDto; |
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.
unused import
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.
fixed
for (SearchResultDto dto : arg) { | ||
results.add(new SearchResult(dto)); | ||
} | ||
return results; |
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.
We can do it like return arg.stream().map(SearchResult::new).collect(toList());
, but up to you - what is more readable...
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.
Agree with @RomanNikitenko .. @vparfonov can you take a look?
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.
public Promise<List<? extends SearchResult>> search(QueryExpression expression) {
@@ -14,13 +14,16 @@ | |||
import com.google.common.base.Optional; | |||
|
|||
import org.eclipse.che.api.core.model.project.type.ProjectType; | |||
import org.eclipse.che.api.project.shared.dto.SearchResultDto; |
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.
unused import
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.
fixed
path = searchResultDto.getItemReference().getPath(); | ||
project = searchResultDto.getItemReference().getProject(); | ||
final List<Link> links = searchResultDto.getItemReference().getLinks(); | ||
if (!links.isEmpty() && links.contains(Constants.LINK_REL_GET_CONTENT)) { |
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.
Are you sure the check links.contains(Constants.LINK_REL_GET_CONTENT)
is correct?
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.
fixed
@@ -14,6 +14,7 @@ | |||
import com.google.common.base.Optional; | |||
|
|||
import org.eclipse.che.api.core.model.project.ProjectConfig; | |||
import org.eclipse.che.api.project.shared.dto.SearchResultDto; |
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.
unused import
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.
fixed
@@ -22,6 +22,7 @@ | |||
import org.eclipse.che.api.core.model.project.ProjectConfig; | |||
import org.eclipse.che.api.core.model.project.SourceStorage; | |||
import org.eclipse.che.api.core.rest.shared.dto.Link; | |||
import org.eclipse.che.api.project.shared.dto.SearchResultDto; |
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.
unused import
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.
fixed
@@ -19,6 +19,7 @@ | |||
import org.eclipse.che.ide.api.data.tree.settings.NodeSettings; | |||
import org.eclipse.che.ide.api.editor.EditorAgent; | |||
import org.eclipse.che.ide.api.resources.File; | |||
import org.eclipse.che.ide.api.resources.SearchResult; |
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.
unused import
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.
fixed
import org.eclipse.che.ide.api.editor.EditorAgent; | ||
import org.eclipse.che.ide.api.resources.SearchResult; | ||
import org.eclipse.che.ide.search.factory.FindResultNodeFactory; | ||
import org.eclipse.che.ide.ui.smartTree.TreeStyles; | ||
import org.eclipse.che.ide.ui.smartTree.compare.NameComparator; |
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.
please remove a few unused imports above
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.
fixed
protected Promise<List<Node>> getChildrenImpl() { | ||
List<Node> fileNodes = new ArrayList<>(); | ||
List<SearchOccurrence> occurrences = searchResult.getOccurrences(); | ||
occurrences.sort(Comparator.comparingInt((SearchOccurrence searchOccurrence) -> searchOccurrence.getLineNumber())); |
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.
Can be simplified (SearchOccurrence searchOccurrence) -> searchOccurrence.getLineNumber())
-> SearchOccurrence::getLineNumber
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.
done
|
||
/** {@inheritDoc} */ | ||
@Override | ||
public NodePresentation getPresentation(boolean update) { |
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.
We will do updatePresentation(nodePresentation)
twice when nodePresentation == null
and update
is true
. Is it OK?
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.
fixed
|
||
final SearchResult result = searcher.search(expr); | ||
final List<SearchResultEntry> searchResultEntries = result.getResults(); | ||
final List<ItemReference> items = new ArrayList<>(searchResultEntries.size()); | ||
final List<SearchResultDto> s = new ArrayList<>(searchResultEntries.size()); |
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.
May be makes sense something more readable as name of variable instead of s, WDYT?
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.
done
Build # 3250 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/3250/ to view the results. |
// verify(view).showSelectPathDialog(); | ||
// verify(view, never()).getSearchText(); | ||
// } | ||
//} |
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.
Maybe should to remove this code or rework
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.
fixed
* @return | ||
*/ | ||
String getLineContent(); | ||
} |
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.
need to fix javadoc
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.
fixed
*/ | ||
SearchOccurrenceDto withLineContent(String lineContent); | ||
|
||
} |
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.
need to fix javadoc
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.
fixed
@@ -80,6 +80,11 @@ | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.lucene</groupId> | |||
<artifactId>lucene-highlighter</artifactId> | |||
<version>5.2.1</version> |
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 think need to move version to the parent pom
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.
yes, will be fixed after eclipse-che/che-dependencies#50
* @param searchResultEntries | ||
* @return | ||
* @throws ServerException | ||
*/ |
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.
fix java doc
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.
fixed
|
||
if ((endOffset > txt.length()) || (startOffset > txt.length())) { | ||
throw new ServerException( | ||
"Token " + termAtt.toString() + " exceeds length of provided text sized " + txt.length()); |
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.
typo sized -> size
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.
done
Build # 3256 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/3256/ to view the results. |
Build # 3266 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/3266/ to view the results. |
line numbers are shown for matches multiple matches in the same file are shown individually when you click on a search result, the editor loads the file AND jumps straight to the matching line with all instances of the search term already highlighted Signed-off-by: Vitalii Parfonov <vparfonov@redhat.com>
1e04c5e
to
90e5866
Compare
for (SearchResultDto dto : arg) { | ||
results.add(new SearchResult(dto)); | ||
} | ||
return results; |
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.
Agree with @RomanNikitenko .. @vparfonov can you take a look?
import java.util.List; | ||
|
||
/** | ||
* @author Vitalii Parfonov |
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.
javadoc
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.
Actually class represents a POJO with a readable name.
javadoc is not necessary
ReadFileUtils.getLine(tempFile.toFile(), 10000); | ||
|
||
} | ||
|
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.
too many new lines.
Build # 3268 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/3268/ to view the results. |
Do we need selenium tests to keep up to date? |
@tolusha yes, @SkorikSergey already start work on it |
Signed-off-by: Vitalii Parfonov <vparfonov@redhat.com>
Build # 3277 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/3277/ to view the results. |
Signed-off-by: Vitalii Parfonov <vparfonov@redhat.com>
This reverts commit 83150f4.
Build # 3367 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/3367/ to view the results. |
* CHE-5714:Improving search results: line numbers are shown for matches multiple matches in the same file are shown individually when you click on a search result, the editor loads the file AND jumps straight to the matching line with all instances of the search term already highlighted Signed-off-by: Vitalii Parfonov <vparfonov@redhat.com> * Code cleanup Signed-off-by: Vitalii Parfonov <vparfonov@redhat.com>
…e-che#5988) This reverts commit 83150f4.
What does this PR do?
Improving search results:
What issues does this PR fix or reference?
#5174
related to eclipse-che/che-dependencies#50
Changelog
ProjectService#search() now return different objects, now it will be
List<SearchResultDto>
instead ofList<ItemReference>
Release Notes
Improving search results:
NOTE: ProjectService#search() now return different objects, now it will be
List<SearchResultDto>
instead ofList<ItemReference>