Examples of Hits


Examples of com.liferay.portal.kernel.search.Hits

      String middleName = null;
      String lastName = null;
      String screenName = null;
      String emailAddress = null;

      Hits hits = UserLocalServiceUtil.search(companyId, firstName, middleName, lastName, screenName,
          emailAddress, status, params, andSearch, QueryUtil.ALL_POS, QueryUtil.ALL_POS, sort);
      totalCount = hits.getLength();

    }
    catch (Exception e) {
      logger.error(e.getMessage(), e);
    }
View Full Code Here

Examples of net.sf.katta.lib.lucene.Hits

    // final Query query = new QueryParser("", new
    // KeywordAnalyzer()).parse(fieldName + ": " + queryTerm);
    final Query query = new QueryParser(Version.LUCENE_30, "", new KeywordAnalyzer()).parse(fieldName + ": "
            + queryTerm);
    final TopDocs searchResultsLucene;
    final Hits searchResultsKatta;
    if (sort == null) {
      searchResultsLucene = indexSearcher.search(query, resultCount);
      searchResultsKatta = _client.search(query, new String[] { kattaIndexName }, resultCount);
    } else {
      searchResultsLucene = indexSearcher.search(query, null, resultCount, sort);
      searchResultsKatta = _client.search(query, new String[] { kattaIndexName }, resultCount, sort);
    }

    assertEquals(searchResultsLucene.totalHits, searchResultsKatta.size());

    ScoreDoc[] scoreDocs = searchResultsLucene.scoreDocs;
    List<Hit> hits = searchResultsKatta.getHits();
    if (sort == null) {
      for (int i = 0; i < scoreDocs.length; i++) {
        assertEquals(scoreDocs[i].score, hits.get(i).getScore(), 0.0);
      }
    } else {
View Full Code Here

Examples of org.apache.camel.processor.lucene.support.Hits

    public Hits search(String searchPhrase, int maxNumberOfHits) throws Exception {
        return search(searchPhrase, maxNumberOfHits, Version.LUCENE_4_9);
    }

    public Hits search(String searchPhrase, int maxNumberOfHits, Version luceneVersion) throws Exception {
        Hits searchHits = new Hits();

        int numberOfHits = doSearch(searchPhrase, maxNumberOfHits, luceneVersion);
        searchHits.setNumberOfHits(numberOfHits);

        for (ScoreDoc hit : hits) {
            Document selectedDocument = indexSearcher.doc(hit.doc);
            Hit aHit = new Hit();
            aHit.setHitLocation(hit.doc);
            aHit.setScore(hit.score);
            aHit.setData(selectedDocument.get("contents"));
            searchHits.getHit().add(aHit);
        }       

        return searchHits;
    }
View Full Code Here

Examples of org.apache.jackrabbit.core.query.lucene.hits.Hits

                String uuid = reader.document(i, FieldSelectors.UUID).get(FieldNames.UUID);
                uuids.put(i, uuid);
            }

            // get child node entries for each hit
            Hits childrenHits = new AdaptingHits();
            for (String uuid : uuids.values()) {
                NodeId id = new NodeId(uuid);
                try {
                    long time = System.currentTimeMillis();
                    NodeState state = (NodeState) itemMgr.getItemState(id);
                    time = System.currentTimeMillis() - time;
                    log.debug("got NodeState with id {} in {} ms.", id, time);
                    List<ChildNodeEntry> entries;
                    if (nameTest != null) {
                        entries = state.getChildNodeEntries(nameTest);
                    } else {
                        // get all children
                        entries = state.getChildNodeEntries();
                    }
                    for (ChildNodeEntry entry : entries) {
                        NodeId childId = entry.getId();
                        Term uuidTerm = TermFactory.createUUIDTerm(childId.toString());
                        TermDocs docs = reader.termDocs(uuidTerm);
                        try {
                            if (docs.next()) {
                                childrenHits.set(docs.doc());
                            }
                        } finally {
                            docs.close();
                        }
                    }
View Full Code Here

Examples of org.apache.jackrabbit.core.query.lucene.hits.Hits

        /**
         * {@inheritDoc}
         */
        public Hits getHits() throws IOException {
            long time = System.currentTimeMillis();
            Hits childrenHits = new AdaptingHits();
            Hits nameHits = new ScorerHits(nameTestScorer);
            int[] docs = new int[1];
            for (int h = nameHits.next(); h > -1; h = nameHits.next()) {
                docs = hResolver.getParents(h, docs);
                if (docs.length == 1) {
                    // optimize single value
                    if (docIds.contains(docs[0])) {
                        childrenHits.set(h);
View Full Code Here

Examples of org.apache.lucene.search.Hits

    SortField[] s_fields = new SortField[2];
    s_fields[0] = SortField.FIELD_SCORE;
    s_fields[1] = new SortField(searching.getKeywordField(), SortField.INT, true);
    Sort sort = new Sort(s_fields);
       
        Hits hits = searcher.search(comboQuery, multiFilter, sort);
    int numResults = hits.length();
    //System.out.println(numResults + " found............................");
    int result_count = Math.min(numResults, MAX_RESULT_COUNT);
    List results = new ArrayList(result_count);
    for(int i=0;i<result_count;i++){
      Document doc = (Document)hits.doc(i);
      //ӳ���ĵ����Ե�Java������
      Object result = params.getSearchObject().newInstance();
      Enumeration fields = doc.fields();
      while(fields.hasMoreElements()){
        Field field = (Field)fields.nextElement();
View Full Code Here

Examples of org.apache.lucene.search.Hits

    IndexSearcher searcher = buildSearcher( searchFactoryImplementor );
    if ( searcher == null ) {
      return new IteratorImpl( new ArrayList<EntityInfo>( 0 ), noLoader );
    }
    try {
      Hits hits = getHits( searcher );
      int first = first();
      int max = max( first, hits );
      Session sess = (Session) this.session;

      int size = max - first + 1 < 0 ? 0 : max - first + 1;
View Full Code Here

Examples of org.apache.lucene.search.Hits

    SearchFactoryImplementor searchFactory = ContextHelper.getSearchFactoryBySFI( session );

    //find the directories
    IndexSearcher searcher = buildSearcher( searchFactory );
    //FIXME: handle null searcher
    Hits hits;
    try {
      hits = getHits( searcher );
      int first = first();
      int max = max( first, hits );
      DocumentExtractor extractor = new DocumentExtractor( searchFactory, indexProjection );
View Full Code Here

Examples of org.apache.lucene.search.Hits

  public List list() throws HibernateException {
    SearchFactoryImplementor searchFactoryImplementor = ContextHelper.getSearchFactoryBySFI( session );
    //find the directories
    IndexSearcher searcher = buildSearcher( searchFactoryImplementor );
    if ( searcher == null ) return new ArrayList( 0 );
    Hits hits;
    try {
      hits = getHits( searcher );
      int first = first();
      int max = max( first, hits );
      Session sess = (Session) this.session;
View Full Code Here

Examples of org.apache.lucene.search.Hits

   * @param searcher The index searcher.
   * @return The lucene hits.
   * @throws IOException in case there is an error executing the lucene search.
   */
  private Hits getHits(Searcher searcher) throws IOException {
    Hits hits;
    org.apache.lucene.search.Query query = filterQueryByClasses( luceneQuery );
    buildFilters();
    hits = searcher.search( query, filter, sort );
    setResultSize( hits );
    return hits;
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.