lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "T. H. Lin" <easy....@gmail.com>
Subject can I set Boost to the term while indexing?
Date Tue, 18 Nov 2008 17:37:10 GMT
I would like to store a set of keywords in a single field of a document.

for example I have now three keywords: "One", "Two" and "Three"
and I am going to add them into a document.

At first, is this code correct?
/****************************************************************/
String[] keyword = new String[]{"One", "Two", "Three"};
for (int i = 0; i < keyword.length; i++) {
   Field f = new Field("field_name",
                            keyword[i],
                            Field.Store.NO,
                            Field.Index.UN_TOKENIZED,
                            TermVector.YES);
   doc.add(f);
}
indexWriter.addDocument(doc);
/***************************************************************/

when searching, We can set Boost for a query term.

the question is...
Can I set Boost for every keyword/term while indexing?

from the example above. I may set those keywords. i.e. "One", "Two" and
"Three", with different "Weight/Boost/Relavance..." while indexing.
and the same "term" may have different "Weight/Boost/Relavance..." in
different document.

can I do this?

thanks. :-)

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message