Code972 Coding from the back of a camel

About

This blog is maintained by Itamar Syn-Hershko (contact: itamar at this domain).

Itamar Syn-Hershko, a software developer writing mostly for .NET but also in Java and C/C++, really likes fiddling with data, texts especially, so he frequently finds himself working on databases or search engines. Or combining both.

Author of open-source projects like HebMorph and NAppUpdate, and an active participant of others (CLucene for example), Itamar strongly believes in the power of open-source projects and the creativity they can bring to the table.

Here you'll find code snippets, ideas, thoughts, and just links I had to dump somewhere. Hopefully any of those will prove useful.

Follow me on Twitter

Comments (4) Trackbacks (0)
  1. hi
    im new with solr
    and i would like to use it with hebmorph
    is there any good tutorial than i can use ?

  2. hi itamar

    I’m tring to use your heb analizer
    greate job so far!
    the problem is when i send the results to hilghter object
    it dose’nt hilght’s then extara word your analizer found
    for exmple:
    i’m searching for “לבסס”
    extra word your analizer found id “בסיס”
    but the extra word would not be highlite

    thank’s

    here is the relevant code

    //initialized somewhere else
    private MorphAnalyzer analyzer ;
    //do some search … ScoreDoc[] hits = searcher.Search(query, null, 1000) .scoreDocs;
    void DoHighlights(ref Query query, ref Document doc, string FIELD_NAME)
    {
    SimpleHTMLFormatter htmlFormatter = new SimpleHTMLFormatter();
    Highlighter highlighter = new Highlighter(htmlFormatter, new QueryScorer(query));
    highlighter.SetTextFragmenter(new SimpleFragmenter(100));

    System.String text = doc.Get(FIELD_NAME);
    int maxNumFragmentsRequired = 20;

    TokenStream tokenStream = analyzer.TokenStream(FIELD_NAME, new System.IO.StringReader(text));
    System.String [] result = highlighter.GetBestFragments(tokenStream, text, maxNumFragmentsRequired );
    System.String res=”";

    for (i = 0; i < result.Length – 1; i++)
    {

    res = res + result[i] + "”;
    }
    http.Response.Write(“res= ” + “” + res );
    }


Leave a comment

(required)

No trackbacks yet.