Dear Sir,
We are indexing the document content and executing text based search from
document content. Is there way to disable lucene's preference to score
shorter documents higher?
Consider following example
- we have 2 documents A and B
- We execute search based upon text Java
- A document has 10 matching words while document B has 7 words. But size
of document B is smaller than document A. - During search operation document B is assigned higher score because its
size is smaller than document A( Though A has higher count of words Java)
In one of forums we learnt that using omit_norms we can ignore the size of
document while indexing. We tried this approach and still not getting the
desired results.
we are using Java API to create the indexes using XContentBuilder. please
find the code below
-- Creating index
XContentBuilder map = XContentFactory.jsonBuilder().startObject()
.startObject(idxType)
.startObject("properties")
.startObject("file")
.field("type", "attachment")
.field("omit_norm","true")
.startObject("fields")
.startObject("refid")
.field("store", "yes")
.endObject()
.startObject("name")
.field("store", "yes")
.endObject()
.startObject("itexp")
.field("store", "yes")
.endObject()
.startObject("totalexp")
.field("store", "yes")
.endObject()
.endObject()
.endObject()
.endObject()
.endObject();
CreateIndexResponse lResponse =
client.admin().indices().prepareCreate(idxName)
.addMapping("attachment", map).execute().actionGet();
--- Indexing document
XContentBuilder source = XContentFactory.jsonBuilder().startObject()
.field("file", data64)
.field("refid", "2")
.field("name", "Maya")
.field("totalexp",11.0);
Please let me know if above code is correct.We are not getting desired
results even after applying the omit_norms parameter.
Thanks in advance
Hiro Gangwani
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b707663b-7b7b-48cd-ab96-4490a0171ec1%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.