Package org.apache.lucene.search

Examples of org.apache.lucene.search.ScoreDoc


   
    /** Handle Date columns */
    public  Date    getDate( int columnid throws SQLException
    {
    try {
            ScoreDoc    scoreDoc = getScoreDoc();
            int     docID = scoreDoc.doc;
      if ( isKeyID( columnid ) )
            {
                Number  number = getNumberValue( columnid );

View Full Code Here


   
    /** Handle Time columns */
    public  Time    getTime( int columnid throws SQLException
    {
    try {
            ScoreDoc    scoreDoc = getScoreDoc();
            int     docID = scoreDoc.doc;
      if ( isKeyID( columnid ) )
            {
                Number  number = getNumberValue( columnid );

View Full Code Here

   
    /** Handle Timestamp columns */
    public  Timestamp    getTimestamp( int columnid throws SQLException
    {
    try {
            ScoreDoc    scoreDoc = getScoreDoc();
            int     docID = scoreDoc.doc;
      if ( isKeyID( columnid ) )
            {
                Number  number = getNumberValue( columnid );

View Full Code Here

    public  int getInt( int columnid throws SQLException
    {
        _wasNull = false;
       
    try {
            ScoreDoc    scoreDoc = getScoreDoc();
            int     docID = scoreDoc.doc;
      if ( columnid == _docIDColumnID ) { return docID; }
      else if ( isKeyID( columnid ) )
            {
                Number  number = getNumberValue( columnid );
View Full Code Here

    /** Handle byte columns */
    public  byte[]  getBytes( int columnid ) throws SQLException
    {
    try {
            ScoreDoc    scoreDoc = getScoreDoc();
            int     docID = scoreDoc.doc;
           
      if ( isKeyID( columnid ) )
            {
                Document    doc = _searcher.doc( docID );
View Full Code Here

            _searcher = new IndexSearcher( _indexReader );

            Query luceneQuery = qp.parse( _queryText );
            TopScoreDocCollector tsdc = TopScoreDocCollector.create( _windowSize, true);
            if ( _scoreCeiling != null ) {
                tsdc = TopScoreDocCollector.create( _windowSize, new ScoreDoc( 0, _scoreCeiling ), true );
            }

            searchAndScore( luceneQuery, tsdc );
        }
        catch (IOException ioe) { throw LuceneSupport.wrap( ioe ); }
View Full Code Here

//    }
//    CheckHits.checkHits(random(), q, "", indexSearcher, expectedDocs);

    TopDocs docs = indexSearcher.search(q, 1000);//calculates the score
    for (int i = 0; i < docs.scoreDocs.length; i++) {
      ScoreDoc gotSD = docs.scoreDocs[i];
      float expectedScore = scores[gotSD.doc];
      assertEquals("Not equal for doc "+gotSD.doc, expectedScore, gotSD.score, delta);
    }

    CheckHits.checkExplanations(q, "", indexSearcher);
View Full Code Here

      vs = new ReverseOrdFieldSource(field);
    }
    Query q = new FunctionQuery(vs);
    TopDocs td = s.search(q, null, 1000);
    assertEquals("All docs should be matched!", N_DOCS, td.totalHits);
    ScoreDoc sd[] = td.scoreDocs;
    for (int i = 0; i < sd.length; i++) {
      float score = sd[i].score;
      String id = s.getIndexReader().document(sd[i].doc).get(ID_FIELD);
      log("-------- " + i + ". Explain doc " + id);
      log(s.explain(q, sd[i].doc));
View Full Code Here

   * @throws IllegalArgumentException if <code>field</code> was indexed without
   *         {@link IndexOptions#DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS}
   */
  public Map<String,String[]> highlightFields(String fields[], Query query, IndexSearcher searcher, TopDocs topDocs, int maxPassages) throws IOException {
    final IndexReader reader = searcher.getIndexReader();
    final ScoreDoc scoreDocs[] = topDocs.scoreDocs;
    query = rewrite(query);
    SortedSet<Term> queryTerms = new TreeSet<Term>();
    query.extractTerms(queryTerms);

    int docids[] = new int[scoreDocs.length];
View Full Code Here

    FunctionQuery functionQuery = new FunctionQuery(valueSource);
    IndexReader r = DirectoryReader.open(dir);
    IndexSearcher s = new IndexSearcher(r);
    TopDocs td = s.search(functionQuery,null,1000);
    assertEquals("All docs should be matched!",N_DOCS,td.totalHits);
    ScoreDoc sd[] = td.scoreDocs;
    for (ScoreDoc aSd : sd) {
      float score = aSd.score;
      log(s.explain(functionQuery, aSd.doc));
      String id = s.getIndexReader().document(aSd.doc).get(ID_FIELD);
      float expectedScore = expectedFieldScore(id); // "ID7" --> 7.0
View Full Code Here

TOP

Related Classes of org.apache.lucene.search.ScoreDoc

Copyright © 2018 www.massapicom. 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.