lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "kritarth.anand" <>
Subject How to simplifying my query for appropriate scoring.
Date Tue, 10 Jun 2014 02:23:34 GMT
hi all,
I need help simplifying my query. The doc structure is as follows.

id A
cat : p, q, r

id B
cat : m, n ,o

id C
cat: l,b, o

Now given this structure my job is to find documents which have cat ids 
belonging to a list. Right now this is achieved in this fashion using OR of 
multiple queries. given list [p,n,o ] and ranked in the order.

  Query 1:  q : cat:p ---> doc:A
  Query 2 : q : cat n AND !(cat:p) --> B
  Query 3 : q   (cat o AND !(cat:p) AND (cat:n)) --> C

final query = query1^3 OR query2^2 OR query3^1 

this is to ensure the ranking is A,B,C

The query is pretty complicated and gets very long too so I would want to
form a shorter version of it if possible. There are just two constraints.

     a: the highest preference is given to doc with cat:p even if some other
matches all the other terms. so A should be higher than B(even when B
matches both n and o) .

     b. Also if there are two docs which have match on first cat :p, they
should have equal score irrespective of rest of values of cat. For example
consider an additional document D  
id : D
cat :[p,n,o]

Now D and A  both match on first cat p and therefore the fact that D also
matches on n and o should not matter and both A and D should have same

Please let me know if there is a simple way of doing it.

View this message in context:
Sent from the Solr - User mailing list archive at

View raw message