2929import com .marklogic .hub .util .PerformanceLogger ;
3030import com .marklogic .quickstart .model .SearchQuery ;
3131import com .marklogic .quickstart .util .QueryHelper ;
32- import org .codehaus .jettison .json .JSONObject ;
3332import org .w3c .dom .Document ;
3433import org .w3c .dom .Element ;
35- import org .w3c .dom .Node ;
3634
3735import javax .xml .parsers .DocumentBuilder ;
3836import javax .xml .parsers .DocumentBuilderFactory ;
39- import java .io .ByteArrayInputStream ;
40- import java .nio .charset .StandardCharsets ;
4137import java .nio .file .Path ;
4238import java .nio .file .Paths ;
4339import java .util .ArrayList ;
@@ -60,30 +56,20 @@ public SearchService(HubConfig hubConfig) {
6056 this .finalDocMgr = finalClient .newDocumentManager ();
6157 }
6258
63- private Element getOptions (boolean entitiesOnly ) {
59+ private Element getOptions () {
6460 try {
6561 Path dir = Paths .get (hubConfig .projectDir , HubConfig .USER_CONFIG_DIR , HubConfig .SEARCH_OPTIONS_FILE );
6662 if (dir .toFile ().exists ()) {
6763 DocumentBuilderFactory dbf = DocumentBuilderFactory .newInstance ();
6864 DocumentBuilder db = dbf .newDocumentBuilder ();
6965 Document doc = db .parse (dir .toFile ());
70- Element root = doc .getDocumentElement ();
71-
72- if (entitiesOnly ) {
73- String additionalQuery = "<additional-query xmlns=\" http://marklogic.com/appservices/search\" >\n " +
74- " <cts:element-query xmlns:cts=\" http://marklogic.com/cts\" >\n " +
75- " <cts:element xmlns:es=\" http://marklogic.com/entity-services\" >es:instance</cts:element>\n " +
76- " <cts:true-query/>\n " +
77- " </cts:element-query>\n " +
78- " </additional-query>" ;
79- Node n = doc .importNode (db .parse (new ByteArrayInputStream (additionalQuery .getBytes (StandardCharsets .UTF_8 ))).getDocumentElement (), true );
80- root .appendChild (n );
81- }
66+ return doc .getDocumentElement ();
8267 }
8368 }
8469 catch (Exception e ) {
8570 throw new RuntimeException (e );
8671 }
72+
8773 return null ;
8874 }
8975
@@ -118,7 +104,7 @@ public StringHandle search(SearchQuery searchQuery) {
118104
119105 StructuredQueryBuilder .AndQuery sqd = sb .and (queries .toArray (new StructuredQueryDefinition [0 ]));
120106
121- String searchXml = QueryHelper .serializeQuery (sb , sqd , searchQuery .sort , getOptions (searchQuery . entitiesOnly ));
107+ String searchXml = QueryHelper .serializeQuery (sb , sqd , searchQuery .sort , getOptions ());
122108 logger .info (searchXml );
123109 RawCombinedQueryDefinition querydef = queryMgr .newRawCombinedQueryDefinitionAs (Format .XML , searchXml );
124110
0 commit comments