mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
Search: refactoring, rename fragment -> snippet
This commit is contained in:
parent
5c1e3e4791
commit
98f4e59051
2 changed files with 6 additions and 4 deletions
|
|
@ -24,7 +24,6 @@ angular
|
|||
results.$promise.then(function(result) {
|
||||
$scope.notes = result.body;
|
||||
});
|
||||
console.log('Found body: %o', $scope.notes);
|
||||
|
||||
$scope.page = 0;
|
||||
$scope.allResults = false;
|
||||
|
|
@ -64,7 +63,7 @@ angular
|
|||
};
|
||||
}
|
||||
|
||||
var lines = note.fragment
|
||||
var lines = note.snippet
|
||||
.split('\n')
|
||||
.map(function(line, row) {
|
||||
var match = line.match(/<B>(.+?)<\/B>/);
|
||||
|
|
|
|||
|
|
@ -56,6 +56,9 @@ public class SearchService {
|
|||
* @return A list of matching paragraphs (id, text, snippet w/ highlight)
|
||||
*/
|
||||
public List<Map<String, String>> search(String queryStr) {
|
||||
if (null == ramDirectory) {
|
||||
throw new IllegalStateException("Please call .index() first!");
|
||||
}
|
||||
List<Map<String, String>> result = Collections.emptyList();
|
||||
try (IndexReader indexReader = DirectoryReader.open(ramDirectory)) {
|
||||
IndexSearcher indexSearcher = new IndexSearcher(indexReader);
|
||||
|
|
@ -110,8 +113,8 @@ public class SearchService {
|
|||
}
|
||||
String fragment = (frag != null && frag.length > 0) ? frag[0].toString() : "";
|
||||
|
||||
matchingParagraphs.add(ImmutableMap.of("id", path,
|
||||
"name", title, "fragment", fragment, "text", text));
|
||||
matchingParagraphs.add(ImmutableMap.of("id", path, // <noteId>/paragraph/<paragraphId>
|
||||
"name", title, "snippet", fragment, "text", text));
|
||||
} else {
|
||||
LOG.info("{}. No {} for this document", i + 1, ID_FIELD);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue