Package org.fao.geonet.kernel.search.index

Examples of org.fao.geonet.kernel.search.index.GeonetworkMultiReader.document()


            TopDocs tdocs = searcher.search(query, 1);

            if (tdocs.totalHits > 0) {

                Set<String> id = Collections.singleton("_id");
                Document element = reader.document(tdocs.scoreDocs[0].doc, id);
                return element.get("_id");
            }

            return null;
        } finally {
View Full Code Here


           
            for( ScoreDoc sdoc : tdocs.scoreDocs ) {
                Map<String, String> values = new HashMap<String, String>();
               
                DocumentStoredFieldVisitor docVisitor = new DocumentStoredFieldVisitor(returnFields);
                reader.document(sdoc.doc, docVisitor);
                Document doc = docVisitor.getDocument();
               
                for( String fieldname : returnFields ) {
                    values.put(fieldname, doc.get(fieldname));
                }
View Full Code Here

        // for a bit longer:  Commented out since: Dec 10 2012
        // FIXME: strange lucene hack: sometimes it tries to load a deleted document
        // if (reader.isDeleted(i)) continue;
       
        DocumentStoredFieldVisitor idXLinkSelector = new DocumentStoredFieldVisitor("_id", "_hasxlinks");
        reader.document(i, idXLinkSelector);
        Document doc = idXLinkSelector.getDocument();
        String id = doc.get("_id");
        String hasxlinks = doc.get("_hasxlinks");
                if(Log.isDebugEnabled(Geonet.INDEX_ENGINE))
                    Log.debug(Geonet.INDEX_ENGINE, "Got id "+id+" : '"+hasxlinks+"'");
View Full Code Here

        // for a bit longer:  Commented out since: Dec 10 2012
        // FIXME: strange lucene hack: sometimes it tries to load a deleted document
        // if (reader.isDeleted(i)) continue;
       
        DocumentStoredFieldVisitor idChangeDateSelector = new DocumentStoredFieldVisitor("_id", "_changeDate");
                reader.document(i, idChangeDateSelector);
                Document doc = idChangeDateSelector.getDocument();
        String id = doc.get("_id");
        if (id == null) {
          Log.error(Geonet.INDEX_ENGINE, "Document with no _id field skipped! Document is "+doc);
          continue;
View Full Code Here

                    stringCollator.setStrength(Collator.PRIMARY);
                    SortedSet<String> sortedValues = new TreeSet<String>(stringCollator);
          ObjectKeyIntOpenHashMap duplicateValues = new ObjectKeyIntOpenHashMap();
          for (int j = 0; j < hits.scoreDocs.length; j++) {
              DocumentStoredFieldVisitor selector = new DocumentStoredFieldVisitor(fields);
            reader.document(hits.scoreDocs[j].doc, selector);
            Document doc = selector.getDocument();

            // Skip templates and subTemplates
            String[] isTemplate = doc.getValues("_isTemplate");
            if (isTemplate[0] != null && !isTemplate[0].equals("n"))
View Full Code Here

            // --- retrieve results
            List<String> response = new ArrayList<String>();

            for (ScoreDoc sdoc : tdocs.scoreDocs) {
                Document doc = _reader.document(sdoc.doc, _uuidselector);
                String uuid = doc.get("_uuid");
                if (uuid != null)
                    response.add(uuid);
            }
            return response;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.