Package org.apache.lucene.search

Examples of org.apache.lucene.search.Hits.doc()


            // should be > 0 hits
            if (hits.length() > 0) {
                products = new Vector<Product>(hits.length());
                for (int i = 0; i < hits.length(); i++) {
                    Document productDoc = hits.doc(i);
                    CompleteProduct prod = toCompleteProduct(productDoc,
                            getRefs, false);
                    products.add(prod.getProduct());
                }
            } else {
View Full Code Here


            // should be > 0 hits
            if (hits.length() > 0) {
                products = new Vector<Product>(hits.length());
                for (int i = 0; i < hits.length(); i++) {
                    Document productDoc = hits.doc(i);
                    CompleteProduct prod = toCompleteProduct(productDoc,
                            getRefs, false);
                    products.add(prod.getProduct());
                }
            } else {
View Full Code Here

                        + product.getProductId()
                        + "] is not unique in the catalog! Num Hits: ["
                        + hits.length() + "]");
            }

            Document productDoc = hits.doc(0);
            CompleteProduct prod = toCompleteProduct(productDoc, false, true);
            return prod.getMetadata();
        } catch (IOException e) {
            LOG.log(Level.WARNING,
                    "IOException when opening index directory: ["
View Full Code Here

            Hits hits = searcher.search(booleanQuery, sort);
            if (hits.length() > 0) {
                products = new Vector<Product>(n);
                int i = 0;
                while (products.size() < Math.min(n, hits.length())) {
                    Document productDoc = hits.doc(i);
                    CompleteProduct prod = toCompleteProduct(productDoc, false,
                            false);
                    products.add(prod.getProduct());
                    i++;
                }
View Full Code Here

                    products = new Vector<Product>(pageSize);

                    for (int i = startNum; i < Math.min(hits.length(),
                            (startNum + pageSize)); i++) {
                        Document productDoc = hits.doc(i);
                        CompleteProduct prod = toCompleteProduct(productDoc,
                                false, false);
                        products.add(prod.getProduct());
                    }
                } else {
View Full Code Here

                        products.add(prod.getProduct());
                    }
                } else {
                    products = new Vector<Product>(hits.length());
                    for (int i = 0; i < hits.length(); i++) {
                        Document productDoc = hits.doc(i);
                        CompleteProduct prod = toCompleteProduct(productDoc,
                                false, false);
                        products.add(prod.getProduct());
                    }
                }
View Full Code Here

        // go thru more than 'maxr' matches in case the distance filter triggers
        int stop = Math.min(hits.length(), 10 * numSug);
        SuggestWord sugWord = new SuggestWord();
        for (int i = 0; i < stop; i++) {

            sugWord.string = hits.doc(i).get(F_WORD + (language != null ? "-" + language : "")); // get
            // orig
            // word

            // don't suggest a word for itself, that would be silly
            if (sugWord.string == null || word.equals(sugWord.string)) {
View Full Code Here

      Searcher searcher = new IndexSearcher(reader);
      Analyzer analyzer = new StandardAnalyzer();
      Query query = QueryParser.parse(item,"TextPath",analyzer);
      Hits hits = searcher.search(query);
      for(int i = 0; i < hits.length() && i < QueryManager.resultSize; i++){
        Document doc = hits.doc(i);
        String path = doc.get("Path");
        if(!results.contains(path))
          results.add(path);
      }
      if(content){
View Full Code Here

      }
      if(content){
        query = QueryParser.parse(item, "Contents", analyzer);
        hits = searcher.search(query);
        for (int i = 0; i < hits.length() && i < QueryManager.resultSize; i++) {
          Document doc = hits.doc(i);
          String path = doc.get("Path");
          if (!results.contains(path))
            results.add(path);
        }
        query = QueryParser.parse(item, "ExtendedInfosContent", analyzer);
View Full Code Here

            results.add(path);
        }
        query = QueryParser.parse(item, "ExtendedInfosContent", analyzer);
        hits = searcher.search(query);
        for (int i = 0; i < hits.length() && i < QueryManager.resultSize; i++) {
          Document doc = hits.doc(i);
          String path = doc.get("Path");
          if (!results.contains(path))
            results.add(path);
        }
      }
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.