Examples of HitCollector


Examples of org.apache.lucene.search.HitCollector

        try {
          final List<INews> matchingNews = new ArrayList<INews>(3);

          /* Perform Query */
          Query query = ModelSearchQueries.createQuery(filter.getSearch());
          searcher[0].search(query, new HitCollector() {
            @Override
            public void collect(int doc, float score) {
              try {
                Document document = searcher[0].doc(doc);
                int index = Integer.valueOf(document.get(SearchDocument.ENTITY_ID_TEXT));
View Full Code Here

Examples of org.apache.lucene.search.HitCollector

          fieldQuery.add(new BooleanClause(new MatchAllDocsQuery(), Occur.MUST));
      }

      /* Use custom hit collector for performance reasons */
      final List<SearchHit<NewsReference>> resultList = new ArrayList<SearchHit<NewsReference>>();
      HitCollector collector = new HitCollector() {
        @Override
        public void collect(int doc, float score) {
          try {
            Document document = fSearcher.doc(doc);

View Full Code Here

Examples of org.apache.lucene.search.HitCollector

      final IndexSearcher currentSearcher = getCurrentSearcher();
      final List<SearchHit<NewsReference>> resultList = new ArrayList<SearchHit<NewsReference>>();
      final Map<Long, Long> searchResultNewsIds = new HashMap<Long, Long>();

      /* Use custom hit collector for performance reasons */
      HitCollector collector = new HitCollector() {
        @Override
        public void collect(int doc, float score) {
          try {
            Document document = currentSearcher.doc(doc);

View Full Code Here

Examples of org.apache.lucene.search.HitCollector

        searcher = new IndexSearcher((Directory)index);
      else
        searcher = ((MemoryIndex) index).createSearcher();

      final float[] scores = new float[1]; // inits to 0.0f
      searcher.search(query, new HitCollector() {
        public void collect(int doc, float score) {
          scores[0] = score;
        }
      });
      float score = scores[0];
View Full Code Here

Examples of org.apache.lucene.search.HitCollector

        private void calculateParent() throws IOException {
            if (hits == null) {
                hits = new BitSet(reader.maxDoc());

                final IOException[] ex = new IOException[1];
                contextScorer.score(new HitCollector() {
                    public void collect(int doc, float score) {
                        try {
                            doc = hResolver.getParent(doc);
                            if (doc != -1) {
                                hits.set(doc);
View Full Code Here

Examples of org.apache.lucene.search.HitCollector

      throw new IllegalArgumentException("query must not be null");
   
    Searcher searcher = createSearcher();
    try {
      final float[] scores = new float[1]; // inits to 0.0f (no match)
      searcher.search(query, new HitCollector() {
        public void collect(int doc, float score) {
          scores[0] = score;
        }
      });
      float score = scores[0];
View Full Code Here

Examples of org.apache.lucene.search.HitCollector

        try {
            IndexSearcher searcher = new IndexSearcher(reader);
            try {
                Query q = new TermQuery(new Term(
                        FieldNames.WEAK_REFS, id.toString()));
                searcher.search(q, new HitCollector() {
                    public void collect(int doc, float score) {
                        docs.add(doc);
                    }
                });
            } finally {
View Full Code Here

Examples of org.apache.lucene.search.HitCollector

        private void calculateChildren() throws IOException {
            if (uuids == null) {
                uuids = new ArrayList();
//                subQueryHits.clear();
//                hits.clear();
                subQueryScorer.score(new HitCollector() {
                    public void collect(int doc, float score) {
                        subQueryHits.set(doc);
                    }
                });

                TermDocs termDocs = reader.termDocs(new Term(FieldNames.PROPERTIES_SET, refProperty));
                String prefix = FieldNames.createNamedValue(refProperty, "");
                while (termDocs.next()) {
                    int doc = termDocs.doc();
                    
                    String[] values = reader.document(doc).getValues(FieldNames.PROPERTIES);
                    if (values == null) {
                        // no reference properties at all on this node
                        continue;
                    }
                    for (int v = 0; v < values.length; v++) {
                        if (values[v].startsWith(prefix)) {
                            String uuid = values[v].substring(prefix.length());
                           
                            TermDocs node = reader.termDocs(TermFactory.createUUIDTerm(uuid));
                            try {
                                while (node.next()) {
                                    if (subQueryHits.get(node.doc())) {
                                        hits.set(doc);
                                    }
                                }
                            } finally {
                                node.close();
                            }
                        }
                    }
                }
               
                // collect nameTest hits
                final BitSet nameTestHits = new BitSet();
                if (nameTestScorer != null) {
                    nameTestScorer.score(new HitCollector() {
                        public void collect(int doc, float score) {
                            nameTestHits.set(doc);
                        }
                    });
                }
View Full Code Here

Examples of org.apache.lucene.search.HitCollector

        }

        private void calculateChildren() throws IOException {
            if (uuids == null) {
                uuids = new ArrayList();
                contextScorer.score(new HitCollector() {
                    public void collect(int doc, float score) {
                        hits.set(doc);
                    }
                });

                // collect nameTest hits
                final BitSet nameTestHits = new BitSet();
                if (nameTestScorer != null) {
                    nameTestScorer.score(new HitCollector() {
                        public void collect(int doc, float score) {
                            nameTestHits.set(doc);
                        }
                    });
                }
View Full Code Here

Examples of org.apache.lucene.search.HitCollector

        }

        private void calculateChildren() throws IOException {
            if (uuids == null) {
                uuids = new ArrayList();
                contextScorer.score(new HitCollector() {
                    public void collect(int doc, float score) {
                        hits.set(doc);
                    }
                });

                // collect nameTest hits
                final BitSet nameTestHits = new BitSet();
                if (nameTestScorer != null) {
                    nameTestScorer.score(new HitCollector() {
                        public void collect(int doc, float score) {
                            nameTestHits.set(doc);
                        }
                    });
                }
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.