lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "none none" <kor...@lycos.com>
Subject Re: Test Message/ Intorduction
Date Mon, 15 Apr 2002 20:06:53 GMT
Hi,
i am trying to do implement the 'within' search like you said in your  email:
 w/section(w/title(Discharge Summary) wo/4(discharged home)))

I think is not hard add this features to Lucene, if someone with good knoledge of Lucene give
to us some hint.
Please.
Looking at the code i understood the main scenario when a search is fired.
What i don't understand are the PhraseScorer and ExactPhraseScorer classes.

How they works? What happen inside those class? What they do?

Because i think the only difference between an ExactPhraseQuery and a WithinQuery is the way
how they calculate the score.
ExactPhraseQuery make sure that the order of each term in the query is the same inside the
document, doing some check on the position read from the SegmentReader (depending on the Analyzer
too).
WithinQuery should do the same BUT with a little difference:
The order could have a maximum offset of x words (x is the wo/x ->e.g.: buy wo/10 car =>
x=10).
I think i am on the right way, but i need to understand more about the Scorer (see question
above), the TermPositions, and some math used to calculate the score.

My idea, (based on my knoledge about Lucene!) is:

1.The first thing to do is change the QueryParser.jj to make it able to reconize that when
'wo/10' occurs it should instantiate a class
'WithinQuery' and set an internal variable 'withinWords' to '10'.
This happen when you create your query object inside your servlet or jsp page: 

Query query = QueryParser.parse(“your query string”, "your fields name", analyzer);
I NEED HELP TO CHANGE THE QUERYPARSER.JJ BECAUSE I DON'T KNOW JAVACC!!

2.The class WithinQuery should have some kind of method to check the offset (words between,
NOT chars between!!) and build the weights:
- final float sumOfSquaredWeights(Searcher searcher)
- query.normalize(norm);

3.The Query object have a method 'Scorer scorer(Query query, Searcher searcher, IndexReader
reader)'
inside the Query object, the method 'scorer(IndexReader reader);' is called, every XxxxQuery
class must implement this method because it is abstract, so in our WithinQuery this method
will return a WithinQueryScorer object. 

Am i on the right way?

Please let me know. 
I appreciate any help.
Also i am almost done with the Highlight feature, how i can add it to the contribution list?

Thaks,bye.


  



See Dave Matthews Band live or win a signed guitar
http://r.lycos.com/r/bmgfly_mail_dmb/http://win.ipromotions.com/lycos_020201/splash.asp 

--
To unsubscribe, e-mail:   <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>


Mime
View raw message