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
98d4bace
Commit
98d4bace
authored
Jan 30, 2015
by
TJBChris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changes to the search - default property if not specified is default.
parent
f02580f0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
GraphBackedMetadataRepository.java
...adata/repository/graph/GraphBackedMetadataRepository.java
+8
-1
MetadataDiscoveryResource.java
...oop/metadata/web/resources/MetadataDiscoveryResource.java
+1
-1
No files found.
repository/src/main/java/org/apache/hadoop/metadata/repository/graph/GraphBackedMetadataRepository.java
View file @
98d4bace
...
...
@@ -19,12 +19,14 @@
package
org
.
apache
.
hadoop
.
metadata
.
repository
.
graph
;
import
com.thinkaurelius.titan.core.TitanGraph
;
import
com.thinkaurelius.titan.core.TitanIndexQuery.Result
;
import
com.thinkaurelius.titan.core.TitanProperty
;
import
com.thinkaurelius.titan.core.TitanVertex
;
import
com.tinkerpop.blueprints.Direction
;
import
com.tinkerpop.blueprints.Edge
;
import
com.tinkerpop.blueprints.GraphQuery
;
import
com.tinkerpop.blueprints.Vertex
;
import
org.apache.commons.collections.iterators.IteratorChain
;
import
org.apache.hadoop.metadata.IReferenceableInstance
;
import
org.apache.hadoop.metadata.ITypedInstance
;
...
...
@@ -53,6 +55,7 @@ import javax.script.Bindings;
import
javax.script.ScriptEngine
;
import
javax.script.ScriptEngineManager
;
import
javax.script.ScriptException
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
...
...
@@ -273,6 +276,7 @@ public class GraphBackedMetadataRepository implements MetadataRepository {
public
Map
<
String
,
HashMap
<
String
,
JSONObject
>>
textSearch
(
String
searchText
,
int
depth
,
String
prop
)
{
TitanGraph
g
=
(
TitanGraph
)
graphService
.
getBlueprintsGraph
();
HashMap
<
String
,
HashMap
<
String
,
JSONObject
>>
result
=
new
HashMap
<>();
// HashMaps, which contain sub JOSN Objects to be relayed back to the parent.
...
...
@@ -293,8 +297,11 @@ public class GraphBackedMetadataRepository implements MetadataRepository {
}*/
int
resultCount
=
0
;
for
(
Vertex
v:
graphService
.
getBlueprintsGraph
().
query
().
has
(
prop
,
searchText
).
vertices
())
{
//for (Result<Vertex> v: g.indexQuery(Constants.VERTEX_INDEX, "v." + prop + ":(" + searchText + ")").vertices()) {
for
(
Vertex
v:
graphService
.
getBlueprintsGraph
().
query
().
has
(
prop
,
searchText
).
vertices
())
{
//searchWalker(v.getElement(), depth, 0, edges, vertices, null);
searchWalker
(
v
,
depth
,
0
,
edges
,
vertices
,
null
);
resultCount
++;
...
...
webapp/src/main/java/org/apache/hadoop/metadata/web/resources/MetadataDiscoveryResource.java
View file @
98d4bace
...
...
@@ -161,7 +161,7 @@ public class MetadataDiscoveryResource {
@Path
(
"/search/fulltext"
)
@Produces
({
MediaType
.
APPLICATION_JSON
})
public
Response
getFullTextResults
(
@QueryParam
(
"text"
)
final
String
searchText
,
@DefaultValue
(
"1"
)
@QueryParam
(
"depth"
)
final
int
depth
,
@QueryParam
(
"property"
)
final
String
prop
)
{
@DefaultValue
(
"1"
)
@QueryParam
(
"depth"
)
final
int
depth
,
@DefaultValue
(
"guid"
)
@QueryParam
(
"property"
)
final
String
prop
)
{
LOG
.
info
(
"Performing full text search for vertices with property {} matching= {}"
,
prop
,
searchText
);
Preconditions
.
checkNotNull
(
searchText
,
"Invalid argument: \"text\" cannot be null."
);
...
...
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