Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
5ab09475
Commit
5ab09475
authored
5 years ago
by
Bolke de Bruin
Committed by
Madhan Neethiraj
5 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3367: updated search-result to include approximate-total-count if available
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
3eadf7e8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
41 additions
and
2 deletions
+41
-2
AtlasSearchResult.java
...a/org/apache/atlas/model/discovery/AtlasSearchResult.java
+6
-0
ClassificationSearchProcessor.java
...apache/atlas/discovery/ClassificationSearchProcessor.java
+5
-0
EntityDiscoveryService.java
...va/org/apache/atlas/discovery/EntityDiscoveryService.java
+9
-2
EntitySearchProcessor.java
...ava/org/apache/atlas/discovery/EntitySearchProcessor.java
+5
-0
FreeTextSearchProcessor.java
...a/org/apache/atlas/discovery/FreeTextSearchProcessor.java
+5
-0
FullTextSearchProcessor.java
...a/org/apache/atlas/discovery/FullTextSearchProcessor.java
+5
-0
SearchProcessor.java
...main/java/org/apache/atlas/discovery/SearchProcessor.java
+1
-0
TermSearchProcessor.java
.../java/org/apache/atlas/discovery/TermSearchProcessor.java
+5
-0
No files found.
intg/src/main/java/org/apache/atlas/model/discovery/AtlasSearchResult.java
View file @
5ab09475
...
...
@@ -52,6 +52,7 @@ public class AtlasSearchResult implements Serializable {
private
AttributeSearchResult
attributes
;
private
List
<
AtlasFullTextResult
>
fullTextResult
;
private
Map
<
String
,
AtlasEntityHeader
>
referredEntities
;
private
long
approximateCount
=
-
1
;
public
AtlasSearchResult
()
{}
...
...
@@ -126,6 +127,10 @@ public class AtlasSearchResult implements Serializable {
this
.
referredEntities
=
referredEntities
;
}
public
long
getApproximateCount
()
{
return
approximateCount
;
}
public
void
setApproximateCount
(
long
approximateCount
)
{
this
.
approximateCount
=
approximateCount
;
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
queryType
,
searchParameters
,
queryText
,
type
,
classification
,
entities
,
attributes
,
fullTextResult
,
referredEntities
);
}
...
...
@@ -184,6 +189,7 @@ public class AtlasSearchResult implements Serializable {
", attributes="
+
attributes
+
", fullTextResult="
+
fullTextResult
+
", referredEntities="
+
referredEntities
+
", approximateCount="
+
approximateCount
+
'}'
;
}
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/discovery/ClassificationSearchProcessor.java
View file @
5ab09475
...
...
@@ -347,4 +347,9 @@ public class ClassificationSearchProcessor extends SearchProcessor {
LOG
.
debug
(
"<== ClassificationSearchProcessor.filter(): ret.size()={}"
,
entityVertices
.
size
());
}
}
@Override
public
long
getResultCount
()
{
return
(
indexQuery
!=
null
)
?
indexQuery
.
vertexTotals
()
:
-
1
;
}
}
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java
View file @
5ab09475
...
...
@@ -180,6 +180,7 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
LOG
.
debug
(
"Executing Full text query: {}"
,
fullTextQuery
);
}
ret
.
setFullTextResult
(
getIndexQueryResults
(
idxQuery
,
params
,
excludeDeletedEntities
));
ret
.
setApproximateCount
(
idxQuery
.
vertexTotals
());
scrubSearchResults
(
ret
);
...
...
@@ -285,7 +286,8 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
int
resultIdx
=
0
;
for
(
int
indexQueryOffset
=
0
;
;
indexQueryOffset
+=
getMaxResultSetSize
())
{
final
Iterator
<
Result
<?,
?>>
qryResult
=
graph
.
indexQuery
(
Constants
.
FULLTEXT_INDEX
,
idxQuery
,
indexQueryOffset
).
vertices
();
final
AtlasIndexQuery
qry
=
graph
.
indexQuery
(
Constants
.
FULLTEXT_INDEX
,
idxQuery
,
indexQueryOffset
);
final
Iterator
<
Result
<?,
?>>
qryResult
=
qry
.
vertices
();
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"indexQuery: query="
+
idxQuery
+
"; offset="
+
indexQueryOffset
);
...
...
@@ -344,6 +346,10 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
}
}
if
(
ret
.
getApproximateCount
()
<
0
)
{
ret
.
setApproximateCount
(
qry
.
vertexTotals
());
}
if
(
ret
.
getEntities
()
!=
null
&&
ret
.
getEntities
().
size
()
==
resultSize
)
{
break
;
}
...
...
@@ -393,7 +399,6 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
if
(
firstElement
instanceof
AtlasVertex
)
{
for
(
Object
element
:
queryResult
)
{
if
(
element
instanceof
AtlasVertex
)
{
ret
.
addEntity
(
entityRetriever
.
toAtlasEntityHeader
((
AtlasVertex
)
element
));
}
else
{
LOG
.
warn
(
"searchUsingBasicQuery({}): expected an AtlasVertex; found unexpected entry in result {}"
,
basicQuery
,
element
);
...
...
@@ -465,6 +470,8 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
try
{
List
<
AtlasVertex
>
resultList
=
searchContext
.
getSearchProcessor
().
execute
();
ret
.
setApproximateCount
(
searchContext
.
getSearchProcessor
().
getResultCount
());
// By default any attribute that shows up in the search parameter should be sent back in the response
// If additional values are requested then the entityAttributes will be a superset of the all search attributes
// and the explicitly requested attribute(s)
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/discovery/EntitySearchProcessor.java
View file @
5ab09475
...
...
@@ -311,4 +311,9 @@ public class EntitySearchProcessor extends SearchProcessor {
LOG
.
debug
(
"<== EntitySearchProcessor.filter(): ret.size()={}"
,
entityVertices
.
size
());
}
}
@Override
public
long
getResultCount
()
{
return
(
indexQuery
!=
null
)
?
indexQuery
.
vertexTotals
()
:
-
1
;
}
}
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/discovery/FreeTextSearchProcessor.java
View file @
5ab09475
...
...
@@ -174,4 +174,9 @@ public class FreeTextSearchProcessor extends SearchProcessor {
return
ret
;
}
@Override
public
long
getResultCount
()
{
return
indexQuery
.
vertexTotals
();
}
}
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/discovery/FullTextSearchProcessor.java
View file @
5ab09475
...
...
@@ -166,4 +166,9 @@ public class FullTextSearchProcessor extends SearchProcessor {
return
ret
;
}
@Override
public
long
getResultCount
()
{
return
indexQuery
.
vertexTotals
();
}
}
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/discovery/SearchProcessor.java
View file @
5ab09475
...
...
@@ -128,6 +128,7 @@ public abstract class SearchProcessor {
}
public
abstract
List
<
AtlasVertex
>
execute
();
public
abstract
long
getResultCount
();
protected
int
collectResultVertices
(
final
List
<
AtlasVertex
>
ret
,
final
int
startIdx
,
final
int
limit
,
int
resultIdx
,
final
List
<
AtlasVertex
>
entityVertices
)
{
for
(
AtlasVertex
entityVertex
:
entityVertices
)
{
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/discovery/TermSearchProcessor.java
View file @
5ab09475
...
...
@@ -110,4 +110,9 @@ public class TermSearchProcessor extends SearchProcessor {
LOG
.
debug
(
"<== TermSearchProcessor.filter(): ret.size()={}"
,
entityVertices
.
size
());
}
}
@Override
public
long
getResultCount
()
{
return
-
1
;
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment