lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shb <sharo...@gmail.com>
Subject RE: sort lucene results
Date Wed, 25 Feb 2009 14:56:30 GMT

i set the index field like this:

Field nameField = null;
while(rs.next() == true)
            {
                String name = rs.getString("name");
                nameField = new
Field("name",name.trim(),Field.Store.YES,Field.Index.TOKENIZED);
                doc.add(nameField);
                writer.addDocument(doc);
            }

can you  write an example how can i use Tokenizer to boolt the words. 

thanks for the quick answer.


Uwe Schindler wrote:
> 
> With a custom Tokenizer/Analyzer you could boost the words (tokens) during
> indexing by their position, e.g. first word gets factor 100, second 99 and
> so on. As sorting is by relevance, hits where the word is more at the
> beginning gets higher ranking because of boost.
> 
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: uwe@thetaphi.de
> 
>> -----Original Message-----
>> From: shb [mailto:sharonbn@gmail.com]
>> Sent: Wednesday, February 25, 2009 3:31 PM
>> To: java-dev@lucene.apache.org
>> Subject: sort lucene results
>> 
>> 
>> hi i need help.
>> 
>> i need to search by word in sentences with lucene. for example by the
>> word
>> "bbb" i got the right results of all the sentences :
>> 
>> "text  ok ok ok bbb" , "text 2 bbb text " , "bbb  text 4...".
>> 
>> but i need the result by the word place in the sentence like this:
>> 
>> "bbb text 4...". , "text 2 bbb text " , "text 1 ok ok ok bbb" ..
>> 
>> waiting for ideas.. thanks..
>> 
>> 
>> --
>> View this message in context: http://www.nabble.com/sort-lucene-results-
>> tp22203922p22203922.html
>> Sent from the Lucene - Java Developer mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-dev-help@lucene.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/sort-lucene-results-tp22203922p22204437.html
Sent from the Lucene - Java Developer mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message