Hello Mohammad,

 

please could you write how you instantiate the highlighter? Which scorer do you 
use?

Are you using the highlighter version from the highlighter branch?

I would try to find the place, where the exception is thrown.

 

But still, there is a problem along with the ConstantScoreQuery. Both ways to 
highlight a document

that are available now will not work because:

1) If you use the "basic" highlighting - means you use the 
CL_NS2(search,highlight)::QueryScorer - than this scorer calls the 
extractTerms() method which is not

implemented in ConstantScoreQuery  as this query uses filters to match 
documents.

2 the "exact" highlighting - means you use the 
CL_NS2(search,highlight)::SpanHighlightScorer - also does not highlight 
ConstantScoreQueries for the same reason. 

But, you could use this scorer with the original WildcardQuery and allow 
rewriting queries in place. Then if your documents are not too long and 

the single documents does not contain  more the the max clause limit different 
matching terms, then this would work.

 

If you want to use the new highlighter scorer then I could send you piece of 
code, how to call it. 

 

Jiri

 

 

 

From: Ben van Klinken [mailto:bvanklin...@gmail.com] 
Sent: Wednesday, January 05, 2011 12:19 AM
To: clucene-developers@lists.sourceforge.net
Subject: Re: [CLucene-dev] CLucene-developers Digest, Vol 57, Issue 2

 

Hi,

 

The highlighter has changed a lot since i touched it last. Ask Jiri, he sent an 
email about a week ago to the list saying that he had made some changes

 

Ben

On Tue, Jan 4, 2011 at 11:09 AM, muhammad ismael <m.ismae...@gmail.com> wrote:

I tried to use WildcardFilter so i sub-classed QueryParser and reimplemented 
getWildcardQuery function 

CL_NS(search)::Query* WildQueryParser::getWildcardQuery(const TCHAR* _field, 
TCHAR* termStr) 

{
    Query * query =  QueryParser::getWildcardQuery(_field, termStr);
    const char * objectName = query->getObjectName();
    if(strcmp(objectName, "WildcardQuery") == 0)
    {
//        _CLDELETE(objectName);
        Term* t = _CLNEW Term(_field, termStr);
        WildcardFilter * f = new WildcardFilter(t);
        Query* q = new ConstantScoreQuery(f);
//        _CLDELETE(t);
        return q;
    }
//    _CLDELETE(objectName);
    return query;// now query is not wildcardQuery so i will return it as it is.
}


and it searches without any errors and return the results correctly.
but when i tried to highlight search results i got the following error

terminate called after throwing an instance of 'std::logic_error' 

what(): basic_string::_S_construct NULL not valid

 

so i tried to debug and see where is the problem but i am lost in code but i 
think the problem

is in the function 

 

TextFragment** Highlighter::getBestTextFragments( 

        StringBuffer* writeTo,
        TokenStream * tokenStream,
        const TCHAR* text,
        bool mergeContiguousFragments,
        int32_t maxNumFragments)


I tried to debug this function many times , I don't know if i am doing 
something wrong or not?

Mohammad Ismael


------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
CLucene-developers mailing list
CLucene-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/clucene-developers

 

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
CLucene-developers mailing list
CLucene-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/clucene-developers

Reply via email to